Merge pull request #444 from ckb-devrel/develop #156
Workflow file for this run
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: Publish on Tag | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: ["v*.*.*"] | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm install -g pnpm && pnpm i | |
| - name: Verify changesets are consumed | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| pnpm changeset version | |
| if ! git diff --quiet; then | |
| echo "Error: 'pnpm changeset version' produced uncommitted changes on a tag build." | |
| echo "Please run 'pnpm changeset version' locally, commit the resulting changes, and re-create the tag." | |
| git diff | |
| exit 1 | |
| fi | |
| - name: Build | |
| run: pnpm build | |
| # Setup .npmrc file to publish to npm | |
| - name: Publish to npm | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
| run: npm publish --access public |