chore: bump version to 1.0.6 #1
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 to npm | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'package.json' | |
| jobs: | |
| publish: | |
| name: Build and publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Check if version changed | |
| id: version_check | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| PUBLISHED_VERSION=$(npm view ${{ github.event.repository.name }} version 2>/dev/null || echo "0.0.0") | |
| echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| echo "published=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT | |
| if [ "$CURRENT_VERSION" != "$PUBLISHED_VERSION" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Skip (version unchanged) | |
| if: steps.version_check.outputs.changed == 'false' | |
| run: echo "Version ${{ steps.version_check.outputs.current }} is already published. Bump package.json version to trigger a new release." |