Skip to content

Commit ee11dba

Browse files
chore: restore npm publish ci
1 parent 0cbdb8d commit ee11dba

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

.github/workflows/sdk-publish-npm.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22
name: Publish NPM Package
33

44
on:
5-
# For staging/nightly releases
5+
# For staging releases
66
workflow_dispatch:
7-
inputs:
8-
tag:
9-
description: 'NPM tag to publish (latest or nightly)'
10-
required: true
11-
type: choice
12-
options:
13-
- latest
14-
- nightly
15-
default: nightly
167
# For latest releases
178
release:
189
types: [published]
@@ -23,8 +14,9 @@ permissions:
2314
contents: read
2415

2516
jobs:
26-
set-publish-version:
27-
# Run for manual dispatch on any branch (allows nightly releases from any branch)
17+
set-staging-version:
18+
# Only run for manual dispatch
19+
# when running from main branch, sets dist-tag to "nightly"
2820
if: ${{ github.event_name == 'workflow_dispatch' }}
2921
runs-on: ubuntu-latest
3022
steps:
@@ -33,30 +25,30 @@ jobs:
3325
- name: Set up Node.js
3426
uses: actions/setup-node@v4
3527
- name: Set publish version
36-
id: set-publish-version
28+
id: set-staging-version
3729
run: |
3830
BRANCH=$(echo "${{ github.ref_name }}" | sed 's|/|-|g')
3931
COMMIT_SHA="${{ github.sha }}"
4032
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
41-
TAG="${{ github.event.inputs.tag || 'nightly' }}"
42-
# For nightly tag, append commit SHA to version
43-
if [ "$TAG" == "nightly" ]; then
44-
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
45-
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
33+
STAGING_VERSION="${CURRENT_VERSION}-${BRANCH}-${COMMIT_SHA::7}"
34+
echo "VERSION=${STAGING_VERSION}" | tee -a $GITHUB_OUTPUT
35+
if [ "${BRANCH}" = "main" ]; then
36+
echo "DIST_TAG=nightly" | tee -a $GITHUB_OUTPUT
4637
else
47-
echo "VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
38+
echo "DIST_TAG=${BRANCH}" | tee -a $GITHUB_OUTPUT
4839
fi
4940
outputs:
50-
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
41+
VERSION: ${{ steps.set-staging-version.outputs.VERSION }}
42+
DIST_TAG: ${{ steps.set-staging-version.outputs.DIST_TAG }}
5143

5244
publish-npm-staging:
53-
# Run for manual dispatch on any branch (allows nightly releases from any branch)
45+
# Only run for manual dispatch
5446
if: ${{ github.event_name == 'workflow_dispatch' }}
5547
uses: ./.github/workflows/reusable-sdk-npm.yml
56-
needs: set-publish-version
48+
needs: set-staging-version
5749
with:
58-
tag: ${{ github.event.inputs.tag }}
59-
version: ${{ needs.set-publish-version.outputs.VERSION }}
50+
tag: ${{ needs.set-staging-version.outputs.DIST_TAG }}
51+
version: ${{ needs.set-staging-version.outputs.VERSION }}
6052

6153
publish-npm-latest:
6254
# # Only run for release published with tag "web3telegram-v*"

0 commit comments

Comments
 (0)