bump version (v0.7.1) #45
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: [main] | |
| paths: | |
| - 'src/**' | |
| - 'package.json' | |
| - 'tsconfig.json' | |
| - 'SKILL.md' | |
| - '!package-lock.json' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.version-check.outputs.changed }} | |
| current: ${{ steps.version-check.outputs.current }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if version changed | |
| id: version-check | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "current=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| git show HEAD~1:package.json > /tmp/prev-package.json 2>/dev/null || echo '{"version":"0.0.0"}' > /tmp/prev-package.json | |
| PREV_VERSION=$(node -p "require('/tmp/prev-package.json').version") | |
| echo "previous=$PREV_VERSION" >> "$GITHUB_OUTPUT" | |
| if [ "$CURRENT_VERSION" != "$PREV_VERSION" ]; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "Version changed: $PREV_VERSION -> $CURRENT_VERSION" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "Version unchanged: $CURRENT_VERSION" | |
| fi | |
| publish: | |
| needs: [build, check-version] | |
| if: needs.check-version.outputs.changed == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ needs.check-version.outputs.current }} | |
| name: v${{ needs.check-version.outputs.current }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| clawhub-publish: | |
| needs: [build, check-version] | |
| if: needs.check-version.outputs.changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install clawhub CLI | |
| run: npm install -g clawhub | |
| - name: Authenticate with ClawHub | |
| env: | |
| CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }} | |
| run: clawhub login --token "$CLAWHUB_TOKEN" --no-browser | |
| - name: Publish to ClawHub | |
| env: | |
| SKILL_VERSION: ${{ needs.check-version.outputs.current }} | |
| run: clawhub publish . --slug redbook --name "redbook" --version "$SKILL_VERSION" | |
| skip: | |
| needs: [build, check-version] | |
| if: needs.check-version.outputs.changed != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Skip publish | |
| run: echo "Skipping publish - version unchanged" |