Bump docker/build-push-action from 6 to 7 #36
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: release | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # https://github.com/actions/setup-go | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| # https://github.com/goreleaser/goreleaser-action | |
| - name: Run GoReleaser (Tag) | |
| if: github.event_name != 'pull_request' | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # https://github.com/goreleaser/goreleaser-action | |
| - name: Run GoReleaser (PR) | |
| if: github.event_name == 'pull_request' | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: latest | |
| args: release --clean --snapshot --skip=publish --skip=validate | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # https://github.com/actions/upload-artifact | |
| - name: Upload binaries as artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: binaries | |
| path: dist/cli* | |
| image: | |
| runs-on: ubuntu-latest | |
| needs: goreleaser | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| # https://github.com/actions/download-artifact | |
| - name: Download binaries | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: binaries | |
| path: dist | |
| - name: Dist Info | |
| run: | | |
| #!/bin/sh | |
| set -eux | |
| find dist -type f -print0 | xargs -0 sha256sum | |
| # https://github.com/docker/setup-qemu-action | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # https://github.com/docker/setup-buildx-action | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # https://github.com/docker/login-action | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| # https://github.com/docker/login-action | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # https://github.com/actions/github-script | |
| - name: Fetch repository info | |
| id: repo_info | |
| uses: actions/github-script@v8 | |
| with: | |
| result-encoding: string | |
| script: | | |
| const repoInfo = await github.rest.repos.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| return repoInfo.data.license.spdx_id; | |
| # https://github.com/docker/metadata-action | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ github.repository }} | |
| tags: | | |
| type=schedule | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=ref,event=branch | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
| type=ref,event=pr | |
| type=sha | |
| labels: | | |
| org.opencontainers.image.title=${{ github.event.repository.name }} | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.licenses=${{ steps.repo_info.outputs.result }} | |
| org.opencontainers.image.description=${{ github.event.repository.description }} | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| push: true | |
| context: . | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: | | |
| ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # https://github.com/peter-evans/dockerhub-description | |
| - name: Update Docker Hub Description | |
| uses: peter-evans/dockerhub-description@v5 | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN_DOCKERHUB_DESCRIPTION }} | |
| repository: ${{ github.repository }} |