Skip to content

Commit fe889e7

Browse files
ci: enable nightly tag promotion from any branch
1 parent 6459c41 commit fe889e7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ on:
1414

1515
jobs:
1616
set-publish-version:
17-
# Run only on main branch
18-
# if: github.ref == 'refs/heads/main'
17+
# Run on any branch (allows nightly releases from any branch)
1918
runs-on: ubuntu-latest
2019
steps:
2120
- name: Checkout code
@@ -24,21 +23,21 @@ jobs:
2423
uses: actions/setup-node@v4
2524
- name: Set publish version
2625
id: set-publish-version
27-
if: github.event.inputs.tag == 'nightly'
2826
run: |
29-
if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
30-
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
27+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
28+
TAG="${{ github.event.inputs.tag || 'nightly' }}"
29+
# For nightly tag, append commit SHA to version
30+
if [ "$TAG" == "nightly" ]; then
3131
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
3232
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
3333
else
34-
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
34+
echo "VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
3535
fi
3636
outputs:
3737
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
3838

3939
publish-npm:
40-
# Run only on main branch
41-
# if: github.ref == 'refs/heads/main'
40+
# Run on any branch (allows nightly releases from any branch)
4241
uses: ./.github/workflows/reusable-sdk-npm.yml
4342
needs: set-publish-version
4443
with:

0 commit comments

Comments
 (0)