11name : Release - Post Crates Release Activities
22
33on :
4- push :
5- branches :
6- - ' post-crates-release-*'
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : ' Full release version identifier (e.g., stable2512 or stable2512-2)'
8+ required : true
9+ type : string
10+ bump_node_version :
11+ description : ' Bump NODE_VERSION? Select "yes" if this is the first run for this post-crates PR, "no" if re-running or if you have another reason not to bump'
12+ required : true
13+ type : choice
14+ options :
15+ - ' yes'
16+ - ' no'
17+ bump_spec_version :
18+ description : ' Bump spec_version? Select "yes" to bump spec version for all runtimes, "no" if re-running or if you have another reason not to bump'
19+ required : true
20+ type : choice
21+ options :
22+ - ' yes'
23+ - ' no'
724
825permissions :
926 contents : write
6885 git config --global user.signingKey "D8018FBB3F534D866A45998293C5FB5F6A367B51"
6986
7087 - name : Bump NODE_VERSION for polkadot
88+ if : inputs.bump_node_version == 'yes'
7189 run : |
7290 echo "Bumping NODE_VERSION in polkadot..."
7391 FILE="polkadot/node/primitives/src/lib.rs"
87105 echo "Successfully bumped NODE_VERSION from $current_version to $new_version"
88106
89107 - name : Bump NODE_VERSION for polkadot-parachain and polkadot-omni-node
108+ if : inputs.bump_node_version == 'yes'
90109 run : |
91110 echo "Bumping NODE_VERSION in cumulus..."
92111 FILE="cumulus/polkadot-omni-node/lib/src/nodes/mod.rs"
@@ -106,6 +125,7 @@ jobs:
106125 echo "Successfully bumped NODE_VERSION from $current_version to $new_version"
107126
108127 - name : Commit NODE_VERSION bumps
128+ if : inputs.bump_node_version == 'yes'
109129 shell : bash
110130 run : |
111131 . ./.github/scripts/release/release_lib.sh
@@ -118,51 +138,72 @@ jobs:
118138 commit_with_message "Bump NODE_VERSION to $NODE_VERSION"
119139 echo "✅ Successfully committed NODE_VERSION bump"
120140
121- - name : Move prdocs to release folder
141+ - name : Bump spec_version
142+ if : inputs.bump_spec_version == 'yes'
122143 shell : bash
123144 run : |
124145 . ./.github/scripts/release/release_lib.sh
125146
126- # Extract release name from branch name (everything after "post-crates-release-")
127- BRANCH_NAME="${{ github.ref_name }}"
128- echo "Branch name: $BRANCH_NAME"
129-
130- if [[ "$BRANCH_NAME" =~ post-crates-release-(.+)$ ]]; then
131- RELEASE_FOLDER="${BASH_REMATCH[1]}"
132- echo "Release folder name: $RELEASE_FOLDER"
147+ FILE="polkadot/node/primitives/src/lib.rs"
148+ NODE_VERSION=$(grep 'pub const NODE_VERSION' "$FILE" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"')
133149
134- # Use the reorder_prdocs helper function
135- reorder_prdocs "$RELEASE_FOLDER"
150+ # Determine if this is a patch release or new stable release
151+ patch=$(echo "$NODE_VERSION" | awk -F'[.-]' '{print $3}')
152+ if [ "$patch" -gt 0 ]; then
153+ IS_PATCH_RELEASE="true"
154+ printf "📋 Patch release detected (patch=$patch) - bumping spec_version patch part\n"
136155 else
137- echo "WARNING: Could not extract release name from branch name: $BRANCH_NAME"
138- echo "Expected format: post-crates-release-<release-name>"
139- exit 1
156+ IS_PATCH_RELEASE="false"
157+ printf "📋 New stable release detected - bumping spec_version minor part\n"
140158 fi
141159
160+ runtimes_list=$(get_filtered_runtimes_list)
161+
162+ for f in ${runtimes_list[@]}; do
163+ new_version=$(bump_spec_version "$f" "$IS_PATCH_RELEASE")
164+ printf " 🔄 $f → spec_version: $new_version\n"
165+ done
166+
167+ commit_with_message "Bump spec_version for $([ \"$IS_PATCH_RELEASE\" = \"true\" ] && echo \"patch\" || echo \"stable\") release"
168+
169+ - name : Move prdocs to release folder
170+ shell : bash
171+ run : |
172+ . ./.github/scripts/release/release_lib.sh
173+
174+ VERSION="${{ inputs.version }}"
175+ echo "Version: $VERSION"
176+
177+ reorder_prdocs "$VERSION"
178+
142179 - name : Replace path dependencies
143180 run : |
144181 echo "Running replace-all-path-deps.sh..."
145182 bash scripts/release/replace-all-path-deps.sh
146-
183+
147184 # Show git diff to see what changed
148185 git diff --stat
149186
150187 - name : Remove versions where path deps are present
151188 run : |
152189 echo "Running delete-versions-if-path-is-present.sh..."
153190 bash scripts/release/delete-versions-if-path-is-present.sh
154-
191+
155192 # Show git diff to see what changed
156193 git diff --stat
157194
158195 - name : Remove version from umbrella/Cargo.toml
159196 run : |
160197 echo "Running delete-version-from-umbrella.sh..."
161198 bash scripts/release/delete-version-from-umbrella.sh
162-
199+
163200 # Show git diff to see what changed
164201 git diff --stat
165202
203+ - name : Install newer Zepter
204+ run : |
205+ cargo install [email protected] --locked -q && zepter --version 206+
166207 - name : Run Zepter - check issues
167208 run : |
168209 echo "Running zepter run check to identify issues..."
@@ -248,32 +289,36 @@ jobs:
248289 shell : bash
249290 run : |
250291 BRANCH_NAME="${{ github.ref_name }}"
292+ FULL_RELEASE="${{ inputs.version }}"
251293 echo "Current branch: $BRANCH_NAME"
294+ echo "Version: $FULL_RELEASE"
252295
253- # Extract base release branch name
254- if [[ "$BRANCH_NAME" =~ ^post-crates-release-(.+)$ ]]; then
255- FULL_RELEASE="${BASH_REMATCH[1]}"
296+ # Extract base release branch name by removing the last segment after dash
297+ if [[ "$FULL_RELEASE" =~ ^(.+)-[^-]+$ ]]; then
298+ BASE_RELEASE="${BASH_REMATCH[1]}"
299+ else
300+ BASE_RELEASE="$FULL_RELEASE"
301+ fi
256302
257- if [[ "$FULL_RELEASE" =~ ^(.+)-[^-]+$ ]]; then
258- BASE_RELEASE="${BASH_REMATCH[1]}"
259- else
260- BASE_RELEASE="$FULL_RELEASE"
261- fi
303+ # Check if PR already exists
304+ EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_RELEASE" --json number --jq '.[0].number')
262305
306+ if [ -n "$EXISTING_PR" ]; then
307+ echo "✅ PR #$EXISTING_PR already exists for this branch"
308+ echo "PR URL: $(gh pr view $EXISTING_PR --json url --jq '.url')"
309+ else
263310 echo "Creating PR from $BRANCH_NAME to $BASE_RELEASE..."
264311 gh pr create \
265- --title "Post crates release activities for $BASE_RELEASE " \
312+ --title "[${BASE_RELEASE}] Post crates release activities for $FULL_RELEASE " \
266313 --body "Automated PR containing post-crates-release activities:
267- - NODE_VERSION bumps
268- - Path dependencies replacement
269- - Zepter fixes
270- - Taplo formatting
271- - PRDocs reorganization" \
314+ - NODE_VERSION bumps (if selected)
315+ - Path dependencies replacement
316+ - Zepter fixes
317+ - Taplo formatting
318+ - PRDocs reorganization (if prdocs exist) " \
272319 --base "$BASE_RELEASE" \
273- --head "$BRANCH_NAME" || echo "PR may already exist or there was an error creating it"
274- else
275- echo "ERROR: Could not extract base release branch from: $BRANCH_NAME, probably wrong format"
276- exit 1
320+ --head "$BRANCH_NAME"
321+ echo "✅ PR created successfully"
277322 fi
278323
279324 - name : Add comment about spec_version
0 commit comments