Merge pull request #214 from smlx/readme-cleanup #124
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: | |
| push: | |
| branches: | |
| - main | |
| permissions: {} | |
| jobs: | |
| release-tag: | |
| permissions: | |
| # create tag | |
| contents: write | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new-tag: ${{ steps.ccv.outputs.new-tag }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Bump tag if necessary | |
| id: ccv | |
| uses: smlx/ccv@7318e2f25a52dcd550e75384b84983973251a1f8 # v0.10.0 | |
| release-build: | |
| permissions: | |
| # create release | |
| contents: write | |
| # push docker images to registry | |
| packages: write | |
| # required by attest-build-provenance | |
| id-token: write | |
| attestations: write | |
| needs: release-tag | |
| if: needs.release-tag.outputs.new-tag == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 | |
| with: | |
| go-version: stable | |
| - name: Login to GHCR | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: advanced-security/sbom-generator-action@6fe43abf522b2e7a19bc769aec1e6c848614b517 # v0.0.2 | |
| id: sbom | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Move sbom to avoid dirty git | |
| run: mv "$GITHUB_SBOM_PATH" ./sbom.spdx.json | |
| env: | |
| GITHUB_SBOM_PATH: ${{ steps.sbom.outputs.fileName }} | |
| - uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 | |
| id: goreleaser | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_SBOM_PATH: ./sbom.spdx.json | |
| # attest archives | |
| - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 | |
| with: | |
| subject-path: "dist/*.tar.gz" | |
| # parse artifacts to the format required for image attestation | |
| - run: | | |
| echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("go-cli-github:v"))|.extra.Digest')" >> "$GITHUB_OUTPUT" | |
| echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("go-cli-github:v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT" | |
| id: image_metadata_go_cli_github | |
| env: | |
| ARTIFACTS: ${{steps.goreleaser.outputs.artifacts}} | |
| - run: | | |
| echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("another-binary:v"))|.extra.Digest')" >> "$GITHUB_OUTPUT" | |
| echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("another-binary:v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT" | |
| id: image_metadata_another_binary | |
| env: | |
| ARTIFACTS: ${{steps.goreleaser.outputs.artifacts}} | |
| # attest images | |
| - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 | |
| with: | |
| subject-digest: ${{steps.image_metadata_go_cli_github.outputs.digest}} | |
| subject-name: ${{steps.image_metadata_go_cli_github.outputs.name}} | |
| push-to-registry: true | |
| - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 | |
| with: | |
| subject-digest: ${{steps.image_metadata_another_binary.outputs.digest}} | |
| subject-name: ${{steps.image_metadata_another_binary.outputs.name}} | |
| push-to-registry: true |