ci: chore: build images to ghcr
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 39f1e15..d0afe6b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,67 +1,38 @@
name: build
+
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
+
on:
workflow_dispatch:
- inputs:
- image_push:
- type: boolean
- description: 'Push images to Container Registry'
- required: false
- default: false
- pull_request:
- types:
- - opened
- - synchronize
- - reopened
push:
branches:
- - main
+ - 'master'
+ tags:
+ - 'v*'
+ pull_request:
+ branches:
+ - 'master'
+
jobs:
image:
runs-on: ubuntu-latest
- strategy:
- matrix:
- from:
- - jammy
- release:
- - "2023.1"
steps:
- - name: Install QEMU static binaries
- uses: docker/setup-qemu-action@v2
- - name: Configure Buildkit
- uses: docker/setup-buildx-action@v2
- - name: Checkout project
- uses: actions/checkout@v3
- - name: Setup environment variables
- run: echo "PROJECT_REF=${{ github.sha }}" >> "$GITHUB_ENV"
- - name: Authenticate with Quay.io
- uses: docker/login-action@v2
- if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.image_push == true) }}
+ - uses: docker/setup-qemu-action@v3
+ - uses: docker/setup-buildx-action@v3
+ - uses: docker/metadata-action@v5
+ id: meta
with:
- password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- registry: quay.io
- username: ${{ secrets.QUAY_USERNAME }}
- - name: Build image
- uses: docker/build-push-action@v3
+ images: ghcr.io/vexxhost/staffeln
+ - uses: docker/login-action@v3
+ if: github.event_name != 'pull_request'
with:
- build-args: |-
- BUILDER_IMAGE=quay.io/vexxhost/openstack-builder-${{ matrix.from }}
- RUNTIME_IMAGE=quay.io/vexxhost/openstack-runtime-${{ matrix.from }}
- RELEASE=${{ matrix.release }}
- PROJECT=staffln
- PROJECT_REPO=https://github.com/vexxhost/staffeln
- PROJECT_REF=${{ env.PROJECT_REF }}
- cache-from: type=gha,scope=${{ matrix.from }}-${{ matrix.release }}
- cache-to: type=gha,mode=max,scope=${{ matrix.from }}-${{ matrix.release }}
- context: .
- platforms: linux/amd64
- push: ${{ github.event_name == 'push' || inputs.image_push == true }}
- tags: quay.io/vexxhost/staffeln:${{ env.PROJECT_REF }}-${{ matrix.from }}
- - name: Promote image
- uses: akhilerm/tag-push-action@v2.0.0
- if: github.event_name == 'push' && ((matrix.from == 'focal') || (matrix.from == 'jammy' && matrix.release != 'yoga'))
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - uses: docker/build-push-action@v5
with:
- dst: quay.io/vexxhost/staffeln:${{ matrix.release }}
- src: quay.io/vexxhost/staffeln:${{ env.PROJECT_REF }}-${{ matrix.from }}
+ push: ${{ github.event_name != 'pull_request' }}
+ labels: ${{ steps.meta.outputs.labels }}
+ tags: ${{ steps.meta.outputs.tags }}