|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + bump: |
| 7 | + description: 'Version bump type' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - patch |
| 12 | + - minor |
| 13 | + - major |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + id-token: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + publish: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - uses: actions/setup-node@v4 |
| 28 | + with: |
| 29 | + node-version: 22 |
| 30 | + registry-url: https://registry.npmjs.org |
| 31 | + |
| 32 | + - run: npm ci |
| 33 | + |
| 34 | + - name: Run tests |
| 35 | + run: npm test |
| 36 | + |
| 37 | + - name: Configure git |
| 38 | + run: | |
| 39 | + git config user.name "github-actions[bot]" |
| 40 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 41 | +
|
| 42 | + - name: Bump version |
| 43 | + id: bump |
| 44 | + run: | |
| 45 | + # Bump package.json (no git tag yet) |
| 46 | + NEW_VERSION=$(npm version ${{ inputs.bump }} --no-git-tag-version) |
| 47 | + echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" |
| 48 | + echo "version_bare=${NEW_VERSION#v}" >> "$GITHUB_OUTPUT" |
| 49 | +
|
| 50 | + - name: Update version in bin/notion.js |
| 51 | + run: | |
| 52 | + sed -i "s/\.version('[^']*')/\.version('${{ steps.bump.outputs.version_bare }}')/" bin/notion.js |
| 53 | +
|
| 54 | + - name: Update version in skill/marketplace.json |
| 55 | + run: | |
| 56 | + sed -i 's/"version": "[^"]*"/"version": "${{ steps.bump.outputs.version_bare }}"/' skill/marketplace.json |
| 57 | +
|
| 58 | + - name: Commit, tag, push |
| 59 | + run: | |
| 60 | + git add -A |
| 61 | + git commit -m "chore: bump version to ${{ steps.bump.outputs.version_bare }}" |
| 62 | + git tag ${{ steps.bump.outputs.version }} |
| 63 | + git push origin main --tags |
| 64 | +
|
| 65 | + - name: Create GitHub Release |
| 66 | + env: |
| 67 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + run: | |
| 69 | + gh release create ${{ steps.bump.outputs.version }} \ |
| 70 | + --title "${{ steps.bump.outputs.version }}" \ |
| 71 | + --generate-notes |
| 72 | +
|
| 73 | + - name: Publish to npm (OIDC trusted publisher — no token needed) |
| 74 | + run: npm publish --access public --provenance |
0 commit comments