Skip to content

Commit

Permalink
update publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Jul 22, 2024
1 parent 013ac56 commit 5e31fd8
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
name: npm-publish
name: Publish & Release

permissions:
contents: write

on:
push:
branches:
- master
- dev

jobs:
npm-publish:
name: npm-publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@master
uses: actions/setup-node@v3
with:
node-version: 12.0.0
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install
- name: Publish if version has been updated
uses: endel/npm-publish-action@master
run: |
npm ci
npm run build
- id: check
uses: EndBug/version-check@v2
with:
tag_name: "%s"
tag_message: "v%s"
commit_pattern: "^bump (\\S+)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
file-name: package.json
diff-search: true

- name: Publish package on NPM 📦
if: steps.check.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release
if: steps.check.outputs.changed == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.check.outputs.version }}
prerelease: false

0 comments on commit 5e31fd8

Please sign in to comment.