Fix README.md #10
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 | |
| on: | |
| push: | |
| branches: | |
| - release | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: package.json | |
| cache: pnpm | |
| - run: pnpm install | |
| - run: | | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | |
| git config --global user.email "actions@users.noreply.github.com" | |
| git config --global user.name "GitHub Actions" | |
| RELEASE_DESCRIPTION=$(awk '/## \[Unreleased\]/{flag=1; next} /## \[/{flag=0} flag' ./CHANGELOG.md | sed '/^[[:space:]]*$/d') | |
| if echo "$RELEASE_DESCRIPTION" | grep -q '### Changed'; then | |
| pnpm version major | |
| elif echo "$RELEASE_DESCRIPTION" | grep -q '### Added'; then | |
| pnpm version minor | |
| elif echo "$RELEASE_DESCRIPTION" | grep -q '### Fixed'; then | |
| pnpm version patch | |
| fi | |
| ./update-changelog.sh | |
| pnpm publish --provenance --access public --no-git-checks | |
| git push --follow-tags | |
| echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| echo "RELEASE_DESCRIPTION<<EOF" >> $GITHUB_ENV | |
| echo "$RELEASE_DESCRIPTION" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: "Release ${{ env.TAG_NAME }}" | |
| body: ${{ env.RELEASE_DESCRIPTION }} | |
| draft: false | |
| prerelease: false | |
| - run: git fetch --all && git switch main && git rebase release && git push origin main |