Skip to content

Commit bd926e3

Browse files
Added new workflow and fixed sdk publish action message (#406)
This PR fixes #404 Co-authored-by: Kevin <[email protected]>
1 parent c313e13 commit bd926e3

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# DUAL PUBLISHING BEHAVIOR:
44
# LATEST TAG:
55
# - If current version contains "alpha" or "beta" -> publishes 1.0.0
6-
# - If stable version exists -> only publishes on explicit version-type (patch/minor/major/custom)
6+
# - If stable version exists -> only publishes on explicit version-type (minor/major/custom)
7+
# - Patch versions -> skips latest publishing (only publishes to next)
78
# - Auto mode with stable version -> skips latest publishing
89
#
910
# NEXT TAG:
@@ -350,6 +351,10 @@ runs:
350351
echo "🚫 No version change detected for latest tag (${CURRENT_VERSION} → ${NEXT_VERSION})"
351352
echo " Skipping latest publishing since version-type is 'auto' and no increment is needed."
352353
SHOULD_PUBLISH_LATEST="false"
354+
elif [ "$VERSION_TYPE_USED" = "patch" ]; then
355+
echo "🚫 Patch version detected (${CURRENT_VERSION} → ${NEXT_VERSION})"
356+
echo " Skipping latest publishing for patch versions - only publishing to next tag."
357+
SHOULD_PUBLISH_LATEST="false"
353358
else
354359
echo "✅ Version will be updated for latest tag (${CURRENT_VERSION} → ${NEXT_VERSION})"
355360
SHOULD_PUBLISH_LATEST="true"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: 'Manual SDK Release'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version-type:
7+
description: 'Version increment type'
8+
required: true
9+
type: choice
10+
options:
11+
- 'patch'
12+
- 'minor'
13+
- 'major'
14+
- 'custom'
15+
default: 'patch'
16+
custom-version:
17+
description: 'Custom version (e.g., 1.3.4, 2.1.0) - only used when version-type is "custom"'
18+
required: false
19+
type: string
20+
default: ''
21+
ref:
22+
description: 'Branch to build from'
23+
required: false
24+
type: string
25+
default: 'main'
26+
27+
jobs:
28+
release-sdks:
29+
name: 'Release SDK Packages'
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: 'Validate inputs'
34+
run: |
35+
echo "::group::Input validation"
36+
echo "Version type: ${{ inputs.version-type }}"
37+
echo "Custom version: ${{ inputs.custom-version }}"
38+
echo "Branch: ${{ inputs.ref }}"
39+
40+
# Validate that custom-version is provided when version-type is custom
41+
if [ "${{ inputs.version-type }}" = "custom" ]; then
42+
if [ -z "${{ inputs.custom-version }}" ]; then
43+
echo "::error::Custom version must be provided when version-type is 'custom'"
44+
echo "Please provide a valid semantic version (e.g., 1.3.4, 2.0.0, 1.2.1)"
45+
exit 1
46+
fi
47+
48+
# Basic semver validation
49+
if [[ ! "${{ inputs.custom-version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
50+
echo "::error::Invalid custom version format: '${{ inputs.custom-version }}'"
51+
echo "Version must follow semantic versioning format: major.minor.patch (e.g., 1.3.4)"
52+
exit 1
53+
fi
54+
55+
echo "✅ Custom version '${{ inputs.custom-version }}' is valid"
56+
fi
57+
echo "::endgroup::"
58+
59+
- name: 'Deploy JavaScript SDK'
60+
id: deploy-javascript-sdk
61+
uses: ./.github/actions/core-cicd/deployment/deploy-javascript-sdk
62+
with:
63+
ref: ${{ inputs.ref }}
64+
npm-token: ${{ secrets.NPM_TOKEN }}
65+
npm-package-tag: 'latest'
66+
version-type: ${{ inputs.version-type }}
67+
custom-version: ${{ inputs.custom-version }}
68+
github-token: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: 'Display results'
71+
if: always()
72+
run: |
73+
echo "::group::Release Summary"
74+
echo "Version type used: ${{ steps.deploy-javascript-sdk.outputs.version-type-used || inputs.version-type }}"
75+
echo "Published to latest: ${{ steps.deploy-javascript-sdk.outputs.published-latest || 'unknown' }}"
76+
echo "Published to next: ${{ steps.deploy-javascript-sdk.outputs.published-next || 'unknown' }}"
77+
echo "NPM package version: ${{ steps.deploy-javascript-sdk.outputs.npm-package-version || 'unknown' }}"
78+
echo "Next version: ${{ steps.deploy-javascript-sdk.outputs.npm-package-version-next || 'unknown' }}"
79+
echo "::endgroup::"

0 commit comments

Comments
 (0)