File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-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+ with :
27+ node-version : ' 20'
28+
29+ - name : Set publish version
30+ id : set-publish-version
31+ run : |
32+ CURRENT_VERSION=$(npm pkg get version | tr -d '"')
33+ if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
34+ NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA}"
35+ echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
36+ else
37+ echo "VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
38+ fi
39+ outputs :
40+ VERSION : ${{ steps.set-publish-version.outputs.VERSION }}
41+
42+ publish-npm :
43+ # Run only on main branch
44+ if : github.ref == 'refs/heads/main'
45+ uses : ./.github/workflows/reusable-npm.yml
46+ needs : set-publish-version
47+ with :
48+ tag : ${{ github.event.inputs.tag }}
49+ version : ${{ needs.set-publish-version.outputs.VERSION }}
50+ secrets :
51+ npm-token : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments