Repository navigation
Build and Publish #84
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: Build and Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| name: | |
| description: 'When you press run workflow, the npm package will be published.' | |
| default: 'I understand.' | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| always-auth: true | |
| - name: Enable Corepack & activate Yarn latest | |
| run: | | |
| corepack enable | |
| corepack prepare yarn@4.9.2 --activate | |
| - name: Install dependencies | |
| run: | | |
| yarn install --immutable | |
| - name: Run TypeScript check | |
| run: yarn tsc --noEmit | |
| - name: Run tests | |
| run: yarn test | |
| - name: Build package | |
| run: yarn build | |
| - name: Publish to npm | |
| run: yarn npm publish --access public | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |