Docker Release #11
Workflow file for this run
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
| name: Docker Release | |
| on: | |
| release: | |
| types: [published] # published fires for both prerelease + stable; we filter below | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: docker-release-${{ github.event.release.tag_name }} | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| docker: | |
| # only stable releases (skip prereleases) | |
| if: github.event.release.prerelease == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the release tag | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - name: Log in to registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ github.event.release.tag_name }} | |
| type=raw,value=latest | |
| - name: Set git vars | |
| run: | | |
| echo "GIT_DATE=$(git log -1 --format=%cd --date=short)" >> $GITHUB_ENV | |
| echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # caching (speed) | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| GIT_COMMIT=${{ env.GIT_COMMIT }} | |
| GIT_REPOSITORY=${{ github.repository }} | |
| GIT_DATE=${{ env.GIT_DATE }} |