Skip to content

Commit

Permalink
fix: npm publish for public repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjacotic committed Apr 12, 2024
1 parent 2b2d4fa commit 5db8d2f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish SDK package on NPM
on:
push:
tags:
- v*

jobs:
wait:
name: "Wait for tests"
runs-on: ubuntu-latest
steps:
- name: Wait for tests to succeed
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
running-workflow-name: 'Test'
check-regexp: Setup and test.*
publish:
name: Publish
runs-on: ubuntu-latest
needs: wait
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC }}
run: |
REG_TAG_PART="v[[:digit:]]+([[:punct:]]+[[:digit:]]){2}"
REG_TAG="^$REG_TAG_PART$"
REG_TAG_ALPHA="^$REG_TAG_PART-alpha[[:punct:]][[:digit:]]+$"
npm ci && npm run build
npm version $BRANCH_NAME
if [[ $BRANCH_NAME =~ $REG_TAG ]]; then
npm publish
elif [[ $BRANCH_NAME =~ $REG_TAG_ALPHA ]]; then
npm publish --tag alpha
else
echo invalid tag name: $BRANCH_NAME
exit 1
fi
12 changes: 0 additions & 12 deletions .github/workflows/release-js-sdk.yml

This file was deleted.

0 comments on commit 5db8d2f

Please sign in to comment.