|
| 1 | +################################################################################ |
| 2 | +# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> # |
| 3 | +# Edit Makefile.maker.yaml instead. # |
| 4 | +################################################################################ |
| 5 | + |
| 6 | +# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company |
| 7 | +# SPDX-License-Identifier: Apache-2.0 |
| 8 | + |
| 9 | +name: Container Registry GHCR |
| 10 | +"on": |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + workflow_dispatch: {} |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | +jobs: |
| 19 | + build-and-push-image: |
| 20 | + name: Push container to ghcr.io |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Check out code |
| 24 | + uses: actions/checkout@v5 |
| 25 | + - name: Log in to the Container registry |
| 26 | + uses: docker/login-action@v3 |
| 27 | + with: |
| 28 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + registry: ghcr.io |
| 30 | + username: ${{ github.actor }} |
| 31 | + - name: Extract metadata (tags, labels) for Docker |
| 32 | + id: meta |
| 33 | + uses: docker/metadata-action@v5 |
| 34 | + with: |
| 35 | + images: ghcr.io/${{ github.repository }} |
| 36 | + tags: | |
| 37 | + # https://github.com/docker/metadata-action#typeedge |
| 38 | + type=edge |
| 39 | + # https://github.com/docker/metadata-action#latest-tag |
| 40 | + type=raw,value=latest,enable={{is_default_branch}} |
| 41 | + # https://github.com/docker/metadata-action#typesemver |
| 42 | + type=semver,pattern={{raw}} |
| 43 | + type=semver,pattern=v{{major}}.{{minor}} |
| 44 | + type=semver,pattern=v{{major}} |
| 45 | + - name: Set up QEMU |
| 46 | + uses: docker/setup-qemu-action@v3 |
| 47 | + - name: Set up Docker Buildx |
| 48 | + uses: docker/setup-buildx-action@v3 |
| 49 | + - name: Build and push Docker image |
| 50 | + uses: docker/build-push-action@v6 |
| 51 | + with: |
| 52 | + context: . |
| 53 | + labels: ${{ steps.meta.outputs.labels }} |
| 54 | + platforms: linux/amd64,linux/arm64 |
| 55 | + push: true |
| 56 | + tags: ${{ steps.meta.outputs.tags }} |
0 commit comments