Update dependencies #3
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: | |
push: | |
branches: | |
- main | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get package version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Setup node environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: https://registry.npmjs.org | |
- run: npm ci | |
- name: Publish to NPM | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Collect release notes | |
id: collect-release-notes | |
run: | | |
echo "::group::Prepare release notes" | |
RELEASE_NOTES=$(awk -v ver=${{ steps.package-version.outputs.current-version }} '/^## \[/ { if ($2 == "["ver"]") { p=1 } else { p=0 } } p { print }' CHANGELOG.md | tail -n +3) | |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
echo "$RELEASE_NOTES" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
echo "::endgroup::" | |
- name: Create Release Tag | |
id: create-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.package-version.outputs.current-version }} | |
body: ${{ env.RELEASE_NOTES }} | |
token: ${{ secrets.GITHUB_TOKEN }} |