Bump and Publish npm packages #54
Workflow file for this run
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: Bump and Publish npm packages | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: stable, canary, or release candidate? | |
| required: true | |
| type: choice | |
| options: | |
| - canary | |
| - release-candidate | |
| - stable | |
| type: | |
| description: "Type of package to publish" | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| mode: | |
| description: "Mode of package to publish" | |
| required: true | |
| type: choice | |
| options: | |
| - bump_and_publish | |
| - bump | |
| - publish | |
| skip_release_github_patch_notes: | |
| description: "Skip generating release notes for GitHub patch notes?" | |
| required: false | |
| type: boolean | |
| jobs: | |
| bump-version: | |
| name: "Bump Version" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| version: 10.18.3 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| registry-url: "https://registry.npmjs.org/" | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build scripts | |
| run: pnpm run build:scripts | |
| - name: Build plugins | |
| run: pnpm run build:plugins | |
| - name: Run script to bump version & copy files | |
| run: pnpm run release | |
| id: version-bump | |
| env: | |
| VERSION_TYPE: ${{ github.event.inputs.type }} | |
| RELEASE_TYPE: ${{ github.event.inputs.release }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_USER: ${{ github.actor }} | |
| GITHUB_EMAIL: ${{ github.actor }}@users.noreply.github.com | |
| GITHUB_OPTION_MODE: ${{ github.event.inputs.mode }} | |
| - name: Publish canary | |
| if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'canary' }} | |
| run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --tag canary --no-git-checks --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Publish release candidate | |
| if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'release-candidate' }} | |
| run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --tag rc --no-git-checks --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Publish stable | |
| if: ${{ (github.event.inputs.mode == 'bump_and_publish' || github.event.inputs.mode == 'publish') && github.event.inputs.release == 'stable' }} | |
| run: pnpm publish --filter create-vitnode-app --filter @vitnode/core --filter @vitnode/config --filter @vitnode/blog --tag latest --no-git-checks --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Create Pre-release | |
| if: (github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate') && !github.event.inputs.skip_release_github_patch_notes | |
| run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| if: github.event.inputs.release == 'stable' && !github.event.inputs.skip_release_github_patch_notes | |
| run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |