Skip to content

Commit

Permalink
E Updates npm-publish action to also publish release notes on Github
Browse files Browse the repository at this point in the history
  • Loading branch information
jwloka committed May 28, 2024
1 parent 1847e92 commit f600229
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package
name: Create release and publish npm package

on:
push:
Expand All @@ -12,13 +12,19 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup environment
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v3

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
version: 9

- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test
Expand All @@ -41,6 +47,23 @@ jobs:
with:
version: 9
- run: pnpm install --frozen-lockfile
- run: pnpm publish-npm

- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
with:
changelog_file: Release-Notes.md

- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.extract-release-notes.outputs.release_notes }}
env:
# The workflow permissions of the project must be updated to 'Workflows have read and write permissions in the repository for all scopes'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm
run: pnpm publish-npm
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 comments on commit f600229

Please sign in to comment.