|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + description: 'Exact package version (X.Y.Z)' |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + dry_run: |
| 10 | + description: 'Test and pack only' |
| 11 | + required: true |
| 12 | + default: true |
| 13 | + type: boolean |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | +concurrency: |
| 17 | + group: npm-release |
| 18 | + cancel-in-progress: false |
| 19 | +jobs: |
| 20 | + prepare: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 15 |
| 23 | + steps: |
| 24 | + - name: Check release ref |
| 25 | + if: ${{ !inputs.dry_run && github.ref != 'refs/heads/main' }} |
| 26 | + run: exit 1 |
| 27 | + - uses: figma/actions-checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + - uses: figma/actions-setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 |
| 31 | + with: |
| 32 | + node-version: '22.22.0' |
| 33 | + - run: npm ci --ignore-scripts |
| 34 | + - run: npm run release:check |
| 35 | + env: |
| 36 | + RELEASE_VERSION: ${{ inputs.version }} |
| 37 | + RELEASE_DRY_RUN: ${{ inputs.dry_run }} |
| 38 | + - name: Check version availability |
| 39 | + if: ${{ !inputs.dry_run }} |
| 40 | + run: node scripts/release.mjs available |
| 41 | + - uses: figma/actions-upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 42 | + with: |
| 43 | + name: npm-package-${{ github.run_id }}-${{ github.run_attempt }} |
| 44 | + path: | |
| 45 | + .release/package.tgz |
| 46 | + .release/release.json |
| 47 | + .release/notes.md |
| 48 | + include-hidden-files: true |
| 49 | + if-no-files-found: error |
| 50 | + retention-days: 90 |
| 51 | + stage: |
| 52 | + needs: prepare |
| 53 | + if: ${{ !inputs.dry_run && github.ref == 'refs/heads/main' }} |
| 54 | + runs-on: ubuntu-latest |
| 55 | + timeout-minutes: 10 |
| 56 | + environment: npm-release |
| 57 | + permissions: |
| 58 | + contents: read |
| 59 | + id-token: write |
| 60 | + steps: |
| 61 | + - uses: figma/actions-checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 62 | + with: |
| 63 | + persist-credentials: false |
| 64 | + - uses: figma/actions-setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 |
| 65 | + with: |
| 66 | + node-version: '22.22.0' |
| 67 | + - uses: figma/actions-download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 |
| 68 | + with: |
| 69 | + name: npm-package-${{ github.run_id }}-${{ github.run_attempt }} |
| 70 | + path: .release/ |
| 71 | + - run: npm install --global npm@11.15.0 --ignore-scripts --registry=https://registry.npmjs.org |
| 72 | + - run: node scripts/release.mjs verify |
| 73 | + - run: node scripts/release.mjs available |
| 74 | + - name: Stage package |
| 75 | + run: | |
| 76 | + npm stage publish .release/package.tgz --ignore-scripts --access public --provenance --tag latest --registry=https://registry.npmjs.org |
| 77 | + echo 'Package staged. Awaiting maintainer approval on npm.' >> "$GITHUB_STEP_SUMMARY" |
0 commit comments