chore: bump version differently #23
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: Build and Publish API | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Use Node.js LTS | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22.x | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "pnpm" | |
| - name: Install packages | |
| run: pnpm install | |
| - name: Build package | |
| run: pnpm build | |
| - name: Commit changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: Upryzing CI | |
| author_email: upryzing-ci@users.noreply.github.com | |
| message: "chore: build library from latest spec [skip ci]" | |
| - name: Find current API version | |
| id: check-api | |
| run: echo "api-version=$(jq -r .info.version OpenAPI.json)" >> $GITHUB_OUTPUT | |
| - name: Check if tag exists for current version | |
| uses: mukunku/tag-exists-action@v1.6.0 | |
| id: check-tag | |
| with: | |
| tag: ${{ steps.check-api.outputs.api-version }} | |
| - name: Update version in package.json | |
| if: steps.check-tag.outputs.exists == 'false' | |
| run: | | |
| jq '.version="${{ steps.check-api.outputs.api-version }}"' package.json > temp.json | |
| mv temp.json package.json | |
| - name: Commit changes | |
| if: steps.check-tag.outputs.exists == 'false' | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: Upryzing CI | |
| author_email: upryzing-ci@users.noreply.github.com | |
| tag: "${{ steps.check-api.outputs.api-version }} --force" | |
| message: "chore: bump version to ${{ steps.check-api.outputs.api-version }} [skip ci]" | |
| - name: Publish to npm | |
| run: npm publish --provenance --ignore-scripts | |
| if: steps.check-tag.outputs.exists == 'false' | |
| # env: | |
| # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Checkout upryzing.js repository | |
| if: steps.check-tag.outputs.exists == 'false' | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: upryzing/upryzing.js | |
| path: upryzing.js | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update @upryzing/api dependency | |
| if: steps.check-tag.outputs.exists == 'false' | |
| run: cd upryzing.js && pnpm add @upryzing/api@${{ steps.check-api.outputs.api-version }} | |
| - name: Commit changes | |
| if: steps.check-tag.outputs.exists == 'false' | |
| uses: EndBug/add-and-commit@v4 | |
| with: | |
| cwd: "upryzing.js" | |
| author_name: Upryzing CI | |
| author_email: upryzing-ci@users.noreply.github.com | |
| message: "chore: update @upryzing/api to ${{ steps.check-api.outputs.api-version }}" |