File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : publish-npm-sdk
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : ' npm publish tag (e.g., latest, nightly)'
8+ required : true
9+ type : choice
10+ options :
11+ - latest
12+ - nightly
13+ default : nightly
14+
15+ jobs :
16+ set-publish-version :
17+ # Run only on main branch
18+ if : github.ref == 'refs/heads/main'
19+ runs-on : ubuntu-latest
20+ steps :
21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+
24+ - name : Set up Node.js
25+ uses : actions/setup-node@v4
26+
27+ - name : Set publish version
28+ id : set-publish-version
29+ if : github.event.inputs.tag == 'nightly'
30+ run : |
31+ if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
32+ CURRENT_VERSION=$(npm pkg get version | tr -d '"')
33+ NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
34+ echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
35+ else
36+ echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
37+ fi
38+ outputs :
39+ VERSION : ${{ steps.set-publish-version.outputs.VERSION }}
40+
41+ publish-npm :
42+ # Run only on main branch
43+ if : github.ref == 'refs/heads/main'
44+ uses : ./.github/workflows/reusable-npm.yml
45+ needs : set-publish-version
46+ with :
47+ tag : ${{ github.event.inputs.tag }}
48+ version : ${{ needs.set-publish-version.outputs.VERSION }}
49+ secrets :
50+ npm-token : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments