Create Release Note and Publish to npm #1
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: Create Release Note | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Please enter the version" | |
required: true | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
release: | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Update package.json version | |
run: | | |
node -e "let fs = require('fs'); let pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); pkg.version = process.env.VERSION; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));" | |
env: | |
VERSION: ${{ github.event.inputs.version }} | |
- name: Commit Changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add package.json | |
git commit -m "Update version to ${{ github.event.inputs.version }}" | |
git push | |
env: | |
VERSION: ${{ github.event.inputs.version }} | |
- name: Create Release Tag And Note | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ github.event.inputs.version }} | |
uses: release-drafter/release-drafter@v6 | |
with: | |
tag: ${{ env.version }} | |
name: v${{ env.version }} | |
version: ${{ env.version }} | |
publish: true |