chore: release v1.0.0 #3
Workflow file for this run
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: Publish to NPM | |
on: | |
# trigger manually | |
workflow_dispatch: | |
# trigger when a new tag is pushed | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
publish: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Setup Environment | |
# set PACKAGE_VERSION and PACKAGE_NAME | |
run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV | |
- name: Install Dependencies | |
run: | | |
npm install pnpm -g | |
pnpm install --no-frozen-lockfile | |
- name: Build Package | |
run: pnpm run build | |
- name: Read Changelog | |
id: changelog | |
uses: artlaman/conventional-changelog-reader-action@v1.1.0 | |
with: | |
version: ${{ env.PACKAGE_VERSION }} | |
path: ./CHANGELOG.md | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
name: v${{ env.PACKAGE_VERSION }} | |
body: ${{ steps.changelog.outputs.changes }} | |
draft: false | |
prerelease: false | |
files: ./${{ env.PACKAGE_NAME }}.zip | |
- name: Publish | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN | |
npm publish | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |