|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + permissions: |
| 15 | + id-token: write # To sign attestations |
| 16 | + attestations: write # To push build provenance to attestations store |
| 17 | + contents: write # To create the release |
| 18 | + |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: Setup bnd |
| 22 | + uses: carabiner-dev/actions/install/bnd@HEAD |
| 23 | + |
| 24 | + - name: Check out code |
| 25 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + fetch-depth: 1 |
| 29 | + |
| 30 | + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 31 | + with: |
| 32 | + go-version-file: sourcetool/go.mod |
| 33 | + cache: false |
| 34 | + |
| 35 | + - name: Install tejolote |
| 36 | + uses: kubernetes-sigs/release-actions/setup-tejolote@a30d93cf2aa029e1e4c8a6c79f766aebf429fddb # v0.3.1 |
| 37 | + with: |
| 38 | + tejolote-release: "0.4.1" |
| 39 | + |
| 40 | + - name: Set tag output |
| 41 | + id: tag |
| 42 | + run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT" |
| 43 | + |
| 44 | + - name: Run GoReleaser |
| 45 | + uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 |
| 46 | + id: goreleaser |
| 47 | + with: |
| 48 | + args: release --clean |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + - name: Generate Provenance |
| 53 | + id: tejolote |
| 54 | + env: |
| 55 | + GH_TOKEN: ${{ github.token }} |
| 56 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + run: | |
| 58 | + mkdir attestations |
| 59 | + tejolote attest --artifacts github://${{github.repository}}/${{ steps.tag.outputs.tag_name }} github://${{github.repository}}/"${GITHUB_RUN_ID}" --output attestations/provenance.json |
| 60 | + # Remove this once tejolote attests fine |
| 61 | + sed -i 's|https://github.com/Attestations/GitHubActionsWorkflow@v1|https://actions.github.io/buildtypes/workflow/v1|' attestations/provenance.json |
| 62 | + bnd statement attestations/provenance.json -o attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json |
| 63 | + rm attestations/provenance.json |
| 64 | + bnd pack attestations/ > sourcetool.intoto.jsonl |
| 65 | + gh release upload ${{ steps.tag.outputs.tag_name }} sourcetool.intoto.jsonl |
| 66 | + # Remove this once GitHub like the tejolote build predicate |
| 67 | + # bnd push github ${{github.repository}} attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json |
| 68 | +
|
0 commit comments