groceries/.gitea/workflows/docker-image.yml

44 lines
1.1 KiB
YAML

name: Docker Image CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
if: gitea.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: git.jamsch0.dev
username: ${{gitea.actor}}
password: ${{secrets.CI_TOKEN}}
- name: Extract metadata
uses: docker/metadata-action@v4
id: meta
with:
images: git.jamsch0.dev/jamsch0/groceries
tags: type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
# cache-from: type=gha
# cache-to: type=gha,mode=max
push: ${{gitea.event_name != 'pull_request'}}
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}