NPM Publish Patch #33
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: NPM Publish Patch | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
permissions: | |
contents: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pushable" | |
cancel-in-progress: false | |
jobs: | |
CI: | |
uses: ./.github/workflows/ci.yml | |
publish: | |
runs-on: ubuntu-latest | |
needs: CI | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Repository | |
- name: Git Config | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Install PNPM | |
uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'pnpm' | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install Dependencies | |
run: pnpm install | |
- run: pnpm run build:prod | |
name: Build Production | |
- name: Bump Patch Version | |
run: | | |
version=$(pnpm version patch -m "v%s") | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Create Draft Release | |
uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ env.VERSION }} | |
name: ${{ env.VERSION }} | |
version: ${{ env.VERSION }} | |
- run: npm publish | |
name: Publish to NPM | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Push Bumped Version | |
run: | | |
git push | |