diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ff6a254 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,59 @@ +name: Build and Publish Container Image + +on: + push: + branches: + - '**' + tags: + - 'v*' + +jobs: + docker-publish: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + env: + GHCR_IMAGE: ghcr.io/${{ github.repository }} + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up QEMU for Docker Buildx + uses: docker/setup-qemu-action@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + with: + platforms: linux/amd64,linux/arm64 + + - name: Log in to GHCR + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate container metadata + id: meta + uses: docker/metadata-action@v6 + with: + images: ${{ env.GHCR_IMAGE }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push container image + uses: docker/build-push-action@v7 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64