name: Release on: release: types: [published] permissions: contents: write packages: write id-token: write # needed for signing jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 with: go-version-file: 'go.mod' cache: true - name: Install cosign uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 - name: Install Syft uses: anchore/sbom-action/download-syft@v0.20.7 - name: Run GoReleaser uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a with: distribution: goreleaser version: v2.12.0 args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} docker: runs-on: ubuntu-latest needs: goreleaser steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 - name: Log in to Container Registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Get build timestamp id: build-time run: echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT - name: Extract metadata id: meta uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f with: images: ghcr.io/${{ github.repository }} tags: | type=semver,pattern={{version}} type=raw,value=latest - name: Build and push Docker image uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.version }} GIT_COMMIT=${{ github.sha }} BUILD_TIME=${{ steps.build-time.outputs.timestamp }}