@@ -3,6 +3,10 @@ name: publish web ui
3
3
on :
4
4
workflow_dispatch : # Allows manual trigger of the workflow
5
5
inputs :
6
+ current_version :
7
+ description : ' Current version to bump from (e.g., v1.2.3). If not provided, will auto-detect from git tags'
8
+ required : false
9
+ type : string
6
10
custom_version : # Optional input for a custom version
7
11
description : ' Custom version to publish (e.g., v1.2.3) -- only edit if you know what you are doing'
8
12
required : false
19
23
type : boolean
20
24
workflow_call : # Allows trigger of the workflow from another workflow
21
25
inputs :
26
+ current_version :
27
+ description : ' Current version to bump from (e.g., v1.2.3). If not provided, will auto-detect from git tags'
28
+ required : false
29
+ type : string
22
30
custom_version : # Optional input for a custom version
23
31
description : ' Custom version to publish (e.g., v1.2.3) -- only edit if you know what you are doing'
24
32
required : false
@@ -43,11 +51,60 @@ jobs:
43
51
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
44
52
steps :
45
53
- uses : actions/checkout@v4
46
- - id : get-current-version
54
+ - name : Determine current version
55
+ id : get-current-version
47
56
if : github.event.inputs.custom_version != ''
48
- uses : ./.github/actions/get-semantic-release-version
49
- with :
50
- token : ${{ github.event.inputs.token || github.token }}
57
+ shell : bash
58
+ run : |
59
+ if [[ -n "${{ github.event.inputs.current_version }}" ]]; then
60
+ # Use provided current version
61
+ CURRENT_VERSION_RAW="${{ github.event.inputs.current_version }}"
62
+ echo "Using provided current version: $CURRENT_VERSION_RAW"
63
+
64
+ else
65
+ # Auto-detect current version from git tags
66
+ echo "No current version provided, auto-detecting from git tags..."
67
+ source infra/scripts/setup-common-functions.sh
68
+
69
+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
70
+ # If running from a tag, get the previous tag
71
+ CURRENT_TAG="${GITHUB_REF#refs/tags/}"
72
+ echo "Running from tag: $CURRENT_TAG"
73
+
74
+ # Get all tags, sort them, find the one before current tag
75
+ PREVIOUS_TAG=$(git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | grep -B1 "^${CURRENT_TAG}$" | head -1)
76
+
77
+ if [[ -z "$PREVIOUS_TAG" ]]; then
78
+ echo "Error: Could not find previous version before $CURRENT_TAG"
79
+ exit 1
80
+ fi
81
+
82
+ echo "Found previous version: $PREVIOUS_TAG"
83
+ CURRENT_VERSION_RAW="$PREVIOUS_TAG"
84
+
85
+ else
86
+ # If running from branch, get the latest released version
87
+ LATEST_TAG=$(get_tag_release -s)
88
+
89
+ if [[ -z "$LATEST_TAG" ]]; then
90
+ echo "Error: No semantic version tags found in repository"
91
+ exit 1
92
+ fi
93
+
94
+ echo "Latest released version: $LATEST_TAG"
95
+ CURRENT_VERSION_RAW="$LATEST_TAG"
96
+ fi
97
+ fi
98
+
99
+ # Remove 'v' prefix once at the end if present
100
+ if [[ "$CURRENT_VERSION_RAW" =~ ^v ]]; then
101
+ CURRENT_VERSION="${CURRENT_VERSION_RAW:1}"
102
+ else
103
+ CURRENT_VERSION="$CURRENT_VERSION_RAW"
104
+ fi
105
+
106
+ echo "version_without_prefix=$CURRENT_VERSION" >> $GITHUB_OUTPUT
107
+ echo "Final current version (without prefix): $CURRENT_VERSION"
51
108
- name : Setup Node.js
52
109
uses : actions/setup-node@v3
53
110
with :
57
114
env :
58
115
CUSTOM_VERSION : ${{ github.event.inputs.custom_version }}
59
116
run : |
60
- # Get current version from action output (already normalized without 'v' prefix)
117
+ # Get current version from previous step
61
118
CURRENT_VERSION="${{ steps.get-current-version.outputs.version_without_prefix }}"
62
119
63
120
# Normalize custom version (next version) by removing 'v' prefix if present
66
123
NEXT_VERSION="${NEXT_VERSION:1}"
67
124
fi
68
125
69
- echo "Using current version from action : $CURRENT_VERSION"
126
+ echo "Using current version: $CURRENT_VERSION"
70
127
echo "Using next version (custom): $NEXT_VERSION"
71
128
python ./infra/scripts/release/bump_file_versions.py ${CURRENT_VERSION} ${NEXT_VERSION}
72
129
- name : Install yarn dependencies
0 commit comments