update release workflow #10
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: Release | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check Version | |
run: bash ./scripts/check_version.sh ${GITHUB_REF/refs\/tags\//} | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Get the release notes | |
id: get_release_notes | |
run: | | |
VERSION=${{ steps.get_version.outputs.VERSION }} | |
NOTES="$(awk "/## Version $VERSION/{flag=1;next}/## Version/{flag=0}flag" CHANGELOG.md)" | |
NOTES="${NOTES//'%'/'%25'}" | |
NOTES="${NOTES//$'\n'/'%0A'}" | |
NOTES="${NOTES//$'\r'/'%0D'}" | |
echo ::set-output name=NOTES::"$NOTES" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Build | |
run: yarn install && yarn build | |
- name: Release | |
run: yarn publish | |
- name: Github Release | |
uses: actions/[email protected] | |
with: | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
release_name: ${{ steps.get_version.outputs.VERSION }} | |
body: ${{ steps.get_release_notes.outputs.NOTES }} | |
draft: false | |
prerelease: false |