Merge pull request #390 from wneessen/dependabot/github_actions/step-… #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Winni Neessen <wn@neessen.dev> | |
| # | |
| # SPDX-License-Identifier: MIT | |
| name: CD / Docker build and publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Compute build metadata | |
| id: meta | |
| run: | | |
| echo "VERSION=$(git describe --tags --dirty --always)" >> $GITHUB_OUTPUT | |
| echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:latest | |
| ghcr.io/${{ github.repository }}:${{ github.sha }} | |
| build-args: | | |
| VERSION=${{ steps.meta.outputs.VERSION }} | |
| COMMIT=${{ steps.meta.outputs.COMMIT }} | |
| DATE=${{ steps.meta.outputs.DATE }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |