Manual Release and Publish #10
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: Manual Release and Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
versionType: | |
description: 'Version type (major, minor, patch)' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
release-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'node' # Always use the latest stable Node.js version | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install dependencies | |
run: npm ci | |
- name: Configure bot user for Git operations | |
run: | | |
git config user.name "YourBotName" | |
git config user.email "[email protected]" | |
- name: Create Release | |
run: npx standard-version --release-as ${{ github.event.inputs.versionType }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Changes including tags and changelog | |
run: | | |
git push --follow-tags origin main | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # Ensure this secret is set in your repo settings |