1111 runs-on : ubuntu-latest
1212 environment : release
1313 permissions :
14- contents : write # create tag, release, and upload assets
15- id-token : write # Sigstore OIDC keyless signing
16- attestations : write # SLSA build provenance
14+ contents : write # create tag, release, and upload assets
15+ id-token : write # Sigstore OIDC keyless signing
16+ attestations : write # SLSA build provenance
1717
1818 steps :
1919 - name : Harden the runner (Audit all outbound calls)
@@ -23,13 +23,15 @@ jobs:
2323
2424 - name : Checkout repository
2525 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+ with :
27+ fetch-depth : 0
2628
27- - name : Extract version from script
29+ - name : Extract version from source
2830 id : version
2931 run : |
30- version=$(grep -m1 '^AGENT_VERSION=' stepsecurity-dev-machine-guard.sh | sed 's/AGENT_VERSION= "//;s/"//')
32+ version=$(grep -m1 'Version' internal/buildinfo/version.go | sed 's/.* "//;s/".* //')
3133 if [ -z "$version" ]; then
32- echo "::error::Could not extract AGENT_VERSION from script "
34+ echo "::error::Could not extract Version from internal/buildinfo/version.go "
3335 exit 1
3436 fi
3537 tag="v${version}"
@@ -40,14 +42,35 @@ jobs:
4042 - name : Check tag does not already exist
4143 run : |
4244 if git rev-parse "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
43- echo "::error::Tag ${{ steps.version.outputs.tag }} already exists. Bump AGENT_VERSION in the script before releasing."
45+ echo "::error::Tag ${{ steps.version.outputs.tag }} already exists. Bump Version in internal/buildinfo/version.go before releasing."
4446 exit 1
4547 fi
4648
49+ - name : Create tag
50+ run : |
51+ git config user.name "github-actions[bot]"
52+ git config user.email "github-actions[bot]@users.noreply.github.com"
53+ git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
54+ git push origin "${{ steps.version.outputs.tag }}"
55+
56+ - name : Set up Go
57+ uses : actions/setup-go@v5
58+ with :
59+ go-version : " 1.24"
60+
61+ - name : Run GoReleaser
62+ uses : goreleaser/goreleaser-action@v6
63+ with :
64+ distribution : goreleaser
65+ version : latest
66+ args : release --clean
67+ env :
68+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
69+
4770 - name : Install cosign
4871 uses : sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
4972
50- - name : Sign script with Sigstore (keyless)
73+ - name : Sign shell script with Sigstore (keyless)
5174 run : |
5275 cosign sign-blob stepsecurity-dev-machine-guard.sh \
5376 --bundle stepsecurity-dev-machine-guard.sh.bundle \
@@ -60,32 +83,27 @@ jobs:
6083 --certificate-identity-regexp "github.com/step-security/dev-machine-guard" \
6184 --certificate-oidc-issuer "https://token.actions.githubusercontent.com"
6285
63- - name : Generate checksums
86+ - name : Generate shell script checksum
6487 run : |
65- sha256sum stepsecurity-dev-machine-guard.sh > checksums.txt
66- sha256sum stepsecurity-dev-machine-guard.sh.bundle >> checksums.txt
67- echo "Checksums:"
68- cat checksums.txt
88+ sha256sum stepsecurity-dev-machine-guard.sh > shell-checksums.txt
89+ sha256sum stepsecurity-dev-machine-guard.sh.bundle >> shell-checksums.txt
6990
70- - name : Create tag
91+ - name : Upload shell script artifacts to release
92+ env :
93+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7194 run : |
72- git config user.name "github-actions[bot]"
73- git config user.email "github-actions[bot]@users.noreply.github.com"
74- git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
75- git push origin "${{ steps.version.outputs.tag }}"
95+ gh release upload "${{ steps.version.outputs.tag }}" \
96+ stepsecurity-dev-machine-guard.sh.bundle \
97+ shell-checksums.txt
7698
77- - name : Create GitHub Release
78- uses : step-security/action-gh-release@d45511d7589f080cf54961ff056b9705a74fd160 # v2.5 .0
99+ - name : Attest build provenance (Go binaries)
100+ uses : actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1 .0
79101 with :
80- tag_name : ${{ steps.version.outputs.tag }}
81- name : ${{ steps.version.outputs.tag }}
82- generate_release_notes : true
83- files : |
84- stepsecurity-dev-machine-guard.sh
85- stepsecurity-dev-machine-guard.sh.bundle
86- checksums.txt
87-
88- - name : Attest build provenance
102+ subject-path : |
103+ dist/stepsecurity-dev-machine-guard_darwin_amd64_v1/stepsecurity-dev-machine-guard
104+ dist/stepsecurity-dev-machine-guard_darwin_arm64_v1/stepsecurity-dev-machine-guard
105+
106+ - name : Attest build provenance (shell script)
89107 uses : actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
90108 with :
91109 subject-path : stepsecurity-dev-machine-guard.sh
0 commit comments