Skip to content

Commit

Permalink
Add action to publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
4ver committed Feb 27, 2024
1 parent b08ca87 commit 5bb4118
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: npm publish
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: get-nvmrc
run: echo VERSION=$(cat .nvmrc) >> $GITHUB_OUTPUT
- id: get-tag
run: |
if [[ $GITHUB_REF =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
echo TAG=latest >> $GITHUB_OUTPUT
else
echo TAG=beta >> $GITHUB_OUTPUT
fi
- uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org
node-version: ${{ steps.get-nvmrc.outputs.VERSION }}
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_KEY }}
- run: npm run test
- run: npm run build
- run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version
- run: npm publish --tag ${{ steps.get-tag.outputs.TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_KEY }}

0 comments on commit 5bb4118

Please sign in to comment.