|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + id-token: write |
| 11 | + attestations: write |
| 12 | + packages: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + release: |
| 16 | + name: "Release" |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Harden Runner |
| 21 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 22 | + with: |
| 23 | + egress-policy: audit |
| 24 | + |
| 25 | + - name: "Setup: Checkout" |
| 26 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: "Setup: Node" |
| 31 | + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 32 | + with: |
| 33 | + node-version: 24 |
| 34 | + |
| 35 | + - name: "Setup: Bun" |
| 36 | + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 |
| 37 | + with: |
| 38 | + bun-version: latest |
| 39 | + |
| 40 | + - name: "Setup: Cosign" |
| 41 | + uses: sigstore/cosign-installer@f713795cb21599bc4e5c4b58cbad1da852d7eeb9 # v3.9.1 |
| 42 | + |
| 43 | + - name: "Setup: Install Dependencies" |
| 44 | + run: bun install --frozen-lockfile |
| 45 | + |
| 46 | + - name: "Build: Bundle" |
| 47 | + run: bun run build |
| 48 | + |
| 49 | + - name: "Build: Package Artifact" |
| 50 | + run: | |
| 51 | + TAG="${GITHUB_REF_NAME}" |
| 52 | + mkdir -p artifacts |
| 53 | + tar -czf "artifacts/setup-elide-${TAG}.tar.gz" \ |
| 54 | + action.yml \ |
| 55 | + dist/index.js \ |
| 56 | + dist/index.js.map \ |
| 57 | + package.json \ |
| 58 | + LICENSE |
| 59 | + sha256sum "artifacts/setup-elide-${TAG}.tar.gz" > "artifacts/setup-elide-${TAG}.tar.gz.sha256" |
| 60 | + echo "ARTIFACT=artifacts/setup-elide-${TAG}.tar.gz" >> "$GITHUB_ENV" |
| 61 | + echo "ARTIFACT_SHA=artifacts/setup-elide-${TAG}.tar.gz.sha256" >> "$GITHUB_ENV" |
| 62 | +
|
| 63 | + - name: "SBOM: Generate" |
| 64 | + uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0 |
| 65 | + with: |
| 66 | + path: . |
| 67 | + format: spdx-json |
| 68 | + output-file: artifacts/sbom.spdx.json |
| 69 | + |
| 70 | + - name: "Sign: Cosign" |
| 71 | + run: | |
| 72 | + cosign sign-blob \ |
| 73 | + --yes \ |
| 74 | + --bundle "artifacts/setup-elide-${GITHUB_REF_NAME}.tar.gz.cosign-bundle" \ |
| 75 | + "$ARTIFACT" |
| 76 | +
|
| 77 | + - name: "Attest: Build Provenance" |
| 78 | + uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 |
| 79 | + with: |
| 80 | + subject-path: ${{ env.ARTIFACT }} |
| 81 | + |
| 82 | + - name: "Attest: SBOM" |
| 83 | + uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 |
| 84 | + with: |
| 85 | + subject-path: ${{ env.ARTIFACT }} |
| 86 | + sbom-path: artifacts/sbom.spdx.json |
| 87 | + |
| 88 | + - name: "Release: Create" |
| 89 | + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 |
| 90 | + with: |
| 91 | + generate_release_notes: true |
| 92 | + make_latest: true |
| 93 | + fail_on_unmatched_files: true |
| 94 | + files: | |
| 95 | + ${{ env.ARTIFACT }} |
| 96 | + ${{ env.ARTIFACT_SHA }} |
| 97 | + artifacts/sbom.spdx.json |
| 98 | + artifacts/setup-elide-${{ github.ref_name }}.tar.gz.cosign-bundle |
| 99 | +
|
| 100 | + - name: "Release: Update Major Tag" |
| 101 | + run: | |
| 102 | + TAG="${GITHUB_REF_NAME}" |
| 103 | + # Extract major version: v4.1.0 -> v4 |
| 104 | + MAJOR="${TAG%%.*}" |
| 105 | + if [[ "$MAJOR" =~ ^v[0-9]+$ ]]; then |
| 106 | + git tag -f "$MAJOR" "$TAG" |
| 107 | + git push -f origin "$MAJOR" |
| 108 | + echo "Updated major tag $MAJOR -> $TAG" |
| 109 | + fi |
0 commit comments