Prerelease #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prerelease | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_base: | |
| description: Base version before prerelease suffix | |
| required: true | |
| default: 0.0.1 | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| publish: | |
| if: github.ref_name == 'next' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 1. Checkout next | |
| uses: actions/checkout@v4 | |
| - name: 2. Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.30.2 | |
| - name: 3. Setup Node 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - name: 4. Install dependencies | |
| id: install | |
| run: pnpm install --frozen-lockfile | |
| - name: 5. Verify package | |
| id: verify | |
| run: | | |
| pnpm typecheck | |
| pnpm test | |
| - name: 6. Set alpha version | |
| id: version | |
| env: | |
| PACKAGE_VERSION: ${{ inputs.version_base }}-alpha.${{ github.run_number }} | |
| run: | | |
| node -e "const fs = require('node:fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.version = process.env.PACKAGE_VERSION; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');" | |
| node -e "const pkg = require('./package.json'); console.log(pkg.name + '@' + pkg.version);" | |
| node -e "const pkg = require('./package.json'); require('node:fs').appendFileSync(process.env.GITHUB_OUTPUT, 'package=' + pkg.name + '@' + pkg.version + '\n');" | |
| - name: 7. Build and measure package | |
| id: build | |
| run: | | |
| pnpm build | |
| pnpm size | |
| - name: 8. Publish alpha | |
| id: publish | |
| run: pnpm publish --tag alpha --access public --no-git-checks | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: 9. Keep npm latest on current alpha | |
| id: tag | |
| run: | | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| npm dist-tag add "$PACKAGE_NAME@$PACKAGE_VERSION" latest | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Prerelease summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## Alpha prerelease" | |
| echo | |
| echo "| Stage | Result |" | |
| echo "| --- | --- |" | |
| echo "| Install | ${{ steps.install.outcome }} |" | |
| echo "| Verify | ${{ steps.verify.outcome }} |" | |
| echo "| Version | ${{ steps.version.outputs.package }} |" | |
| echo "| Build and size | ${{ steps.build.outcome }} |" | |
| echo "| Publish alpha | ${{ steps.publish.outcome }} |" | |
| echo "| Sync npm latest tag | ${{ steps.tag.outcome }} |" | |
| } >> "$GITHUB_STEP_SUMMARY" |