Prerelease #4
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 | |
| jobs: | |
| publish: | |
| if: github.ref_name == 'next' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.30.2 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 25 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - name: Install | |
| run: pnpm install --frozen-lockfile | |
| - name: Verify | |
| run: | | |
| pnpm typecheck | |
| pnpm test | |
| - name: Set prerelease 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);" | |
| - name: Build package | |
| run: | | |
| pnpm build | |
| pnpm size | |
| - name: Publish prerelease | |
| run: pnpm publish --tag alpha --access public --no-git-checks | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Keep npm latest on current alpha | |
| 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 }} |