Node.js Patch #3
This file contains 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: Node.js Patch | |
on: workflow_dispatch | |
jobs: | |
patch: | |
runs-on: ubuntu-latest | |
if: github.actor != 'nektos/act' && github.ref_name == 'main' | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.patch.outputs.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
ssh-key: ${{ secrets.DEPLOY_KEY_PRIVATE }} | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
- id: patch | |
run: | | |
echo "VERSION=$(pnpm version patch --no-git-tag-version)" >> "$GITHUB_OUTPUT" | |
git add . | |
- id: commit | |
uses: qoomon/actions--create-commit@v1 | |
with: | |
message: 🔖 ${{ steps.patch.outputs.VERSION }} | |
- name: Push | |
run: | | |
eval `ssh-agent -s` | |
ssh-add - <<< "$DEPLOY_KEY_PRIVATE" | |
git push | |
env: | |
DEPLOY_KEY_PRIVATE: ${{ secrets.DEPLOY_KEY_PRIVATE }} | |
- run: gh release create "$VERSION" --generate-notes --target "$COMMIT" --title "$VERSION" | |
env: | |
COMMIT: ${{ steps.commit.outputs.commit }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ steps.patch.outputs.VERSION }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: patch | |
permissions: | |
contents: write # Upload the release files | |
id-token: write # Add `--provenance` | |
packages: write # Publish the package | |
if: github.actor != 'nektos/act' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.patch.outputs.version }} | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
- uses: actions/setup-node@v4 | |
with: | |
cache: pnpm | |
node-version: latest | |
- run: pnpm install | |
- run: pnpm build | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: https://npm.pkg.github.com | |
scope: "@coderabbitai" | |
- run: pnpm publish --access public --no-git-checks --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: https://registry.npmjs.org | |
scope: "@coderabbitai" | |
- run: pnpm publish --access public --no-git-checks --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.CODERABBIT_NPM_TOKEN }} | |
- run: pnpm pack --pack-gzip-level 9 | |
- run: gh release upload "$VERSION" coderabbitai-bitbucket-*.tgz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ needs.patch.outputs.version }} |