Release New Version #17
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: "Release New Version" | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
name: "Publish to NPM" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout source code" | |
uses: actions/checkout@v2 | |
- name: "Set up Node.js" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
registry-url: "https://registry.npmjs.org/" | |
- name: "Install dependencies" | |
run: npm ci | |
- name: "Create build" | |
run: npm run build | |
- name: "Get version from package.json" | |
id: get_version | |
run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
- name: "Set Git user name and email" | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
- name: "Create Git tag for version" | |
run: git tag ${{ steps.get_version.outputs.version }} | |
- name: "Push tag to origin" | |
run: git push origin ${{ steps.get_version.outputs.version }} | |
- name: "Publish to NPM" | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: "Create GitHub Release" | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.get_version.outputs.version }} | |
release_name: Release ${{ steps.get_version.outputs.version }} | |
body: | | |
``` | |
• See CHANGELOG.md for details | |
• Published by ${{ github.actor }} | |
``` | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |