|
| 1 | +# Triggered by: python scripts/release.py --push |
| 2 | + |
| 3 | +name: Release |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - 'v*.*.*' |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: 20 |
| 24 | + cache: npm |
| 25 | + |
| 26 | + - run: npm ci |
| 27 | + - run: npm test |
| 28 | + - run: npm run build |
| 29 | + |
| 30 | + - name: Check dist is up to date |
| 31 | + run: git diff --exit-code -- dist/ ':!dist/**/*.d.ts.map' |
| 32 | + |
| 33 | + # Dogfood: sign dist/index.js using ourselves |
| 34 | + - name: Sign and verify dist/index.js |
| 35 | + uses: ./ |
| 36 | + with: |
| 37 | + passphrase: ${{ secrets.AUTHS_CI_PASSPHRASE }} |
| 38 | + keychain: ${{ secrets.AUTHS_CI_KEYCHAIN }} |
| 39 | + identity-repo: ${{ secrets.AUTHS_CI_IDENTITY_BUNDLE }} |
| 40 | + verify-bundle: ${{ secrets.AUTHS_CI_IDENTITY_BUNDLE_JSON }} |
| 41 | + files: 'dist/index.js' |
| 42 | + verify: true |
| 43 | + note: 'GitHub Actions release — ${{ github.ref_name }}' |
| 44 | + |
| 45 | + - name: Generate SHA256 checksums |
| 46 | + run: | |
| 47 | + cd dist |
| 48 | + sha256sum index.js > index.js.sha256 |
| 49 | + if [ -f index.js.auths.json ]; then |
| 50 | + sha256sum index.js.auths.json >> index.js.sha256 |
| 51 | + fi |
| 52 | + cat index.js.sha256 |
| 53 | +
|
| 54 | + - name: Create GitHub Release |
| 55 | + uses: softprops/action-gh-release@v2 |
| 56 | + with: |
| 57 | + generate_release_notes: true |
| 58 | + make_latest: true |
| 59 | + files: | |
| 60 | + dist/index.js.auths.json |
| 61 | + dist/index.js.sha256 |
| 62 | + body: | |
| 63 | + ## Auths Sign GitHub Action |
| 64 | +
|
| 65 | + Sign build artifacts in CI using [Auths](https://github.com/auths-dev/auths) identity keys. |
| 66 | +
|
| 67 | + ### Usage |
| 68 | +
|
| 69 | + ```yaml |
| 70 | + - uses: auths-dev/sign@${{ github.ref_name }} |
| 71 | + with: |
| 72 | + token: ${{ secrets.AUTHS_CI_TOKEN }} |
| 73 | + files: 'dist/index.js' |
| 74 | + verify: true |
| 75 | + ``` |
| 76 | +
|
| 77 | + See the [README](https://github.com/auths-dev/sign#readme) for full configuration options. |
| 78 | +
|
| 79 | + - name: Update floating major tag |
| 80 | + run: | |
| 81 | + TAG="${GITHUB_REF_NAME}" |
| 82 | + MAJOR="${TAG%%.*}" |
| 83 | + git tag -f "$MAJOR" "$TAG" |
| 84 | + git push origin "$MAJOR" --force |
0 commit comments