From 1b3ceb027ce89d5e82c904dd488efc218d34ed28 Mon Sep 17 00:00:00 2001 From: John Rees Date: Tue, 10 Aug 2021 17:02:52 +0100 Subject: [PATCH 1/2] feat: npm publish main if package version changes --- .github/workflows/npm-publish.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..039ee9b --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,20 @@ +name: Publish to NPM +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm install -g pnpm + - run: pnpm install + - uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + dry-run: true From 731847b9c3fd433e6291aca42505c416c2f4778f Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 15 Dec 2021 17:20:43 +0100 Subject: [PATCH 2/2] successful publish should also create release --- .github/workflows/npm-publish.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 039ee9b..e9b9162 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -3,9 +3,13 @@ on: push: branches: - main + paths: + - 'package.json' + - 'CHANGELOG.md' jobs: publish: + name: Publish to NPM runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,3 +22,20 @@ jobs: with: token: ${{ secrets.NPM_TOKEN }} dry-run: true + + release: + name: Create Github Release + needs: publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets. GITHUB_TOKEN }} + with: + tag_name: v${{ github.ref }} + release_name: v${{ github.ref }} + body_path: CHANGELOG.md + draft: false + prerelease: false + dry-run: true