added discord link to readme (#64) #19
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: Auto Version Bump + Publish | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| version-bump: | |
| runs-on: ubuntu-latest | |
| # Only run on real commits, skip the version bump commit (prevent infinite loop) | |
| if: "!startsWith(github.event.head_commit.message, 'chore(release):')" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - name: Determine bump type | |
| id: bump | |
| run: | | |
| FIRST_LINE=$(echo "${{ github.event.head_commit.message }}" | head -1) | |
| if echo "$FIRST_LINE" | grep -qiE "^BREAKING CHANGE|^.*!:"; then | |
| echo "type=major" >> $GITHUB_OUTPUT | |
| elif echo "$FIRST_LINE" | grep -qiE "^feat"; then | |
| echo "type=minor" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=patch" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Bump version | |
| id: version | |
| run: | | |
| cd cli | |
| npm version ${{ steps.bump.outputs.type }} --no-git-tag-version | |
| echo "new=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Build CLI | |
| run: | | |
| cd cli | |
| npm ci | |
| npm run build | |
| - name: Publish to npm | |
| run: cd cli && npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Commit version bump + tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add cli/package.json cli/package-lock.json | |
| git commit -m "chore(release): v${{ steps.version.outputs.new }} [skip ci]" | |
| git tag "v${{ steps.version.outputs.new }}" | |
| git push && git push origin "v${{ steps.version.outputs.new }}" |