Skip to content

Commit 236dcda

Browse files
BDevParitygithub-actions[bot]
authored andcommitted
BACKPORT-CONFLICT
1 parent 84cb9c9 commit 236dcda

12 files changed

+768
-47
lines changed

.github/scripts/release/release_lib.sh

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ commit_with_message() {
2929
# input: none
3030
# output: list of filtered runtimes
3131
get_filtered_runtimes_list() {
32-
grep_filters=("runtime.*" "test|template|starters|substrate")
32+
grep_filters=("runtime.*" "test|template|starters|substrate|docs")
3333

3434
git grep spec_version: | grep .rs: | grep -e "${grep_filters[0]}" | grep "lib.rs" | grep -vE "${grep_filters[1]}" | cut -d: -f1
3535
}
@@ -91,13 +91,20 @@ function get_spec_version() {
9191
reorder_prdocs() {
9292
VERSION="$1"
9393

94-
printf "[+] ℹ️ Reordering prdocs:"
94+
printf "[+] ℹ️ Reordering prdocs:\n"
9595

9696
VERSION=$(sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+).*$/\1/' <<< "$VERSION") #getting reed of the 'v' prefix
97-
mkdir -p "prdoc/$VERSION"
98-
mv prdoc/pr_*.prdoc prdoc/$VERSION
99-
git add -A
100-
commit_with_message "Reordering prdocs for the release $VERSION"
97+
98+
# Check if there are any prdoc files to move
99+
if ls prdoc/pr_*.prdoc 1> /dev/null 2>&1; then
100+
mkdir -p "prdoc/$VERSION"
101+
mv prdoc/pr_*.prdoc prdoc/$VERSION
102+
git add -A
103+
commit_with_message "Reordering prdocs for the release $VERSION"
104+
echo "✅ Successfully reordered prdocs"
105+
else
106+
echo "⚠️ No prdoc files found to reorder"
107+
fi
101108
}
102109

103110
# Bump the binary version of the polkadot-parachain binary with the
@@ -195,3 +202,50 @@ function get_s3_url_base() {
195202
;;
196203
esac
197204
}
205+
206+
# Bump spec_version in a runtime file based on release type
207+
# For patch release: bump last 3 digits (patch part) by 1
208+
# For new stable release: bump middle part (minor) by 1, reset patch to 0
209+
#
210+
# input:
211+
# - file: path to the runtime file
212+
# - is_patch_release: "true" for patch release, "false" for new stable
213+
# output: prints the new spec_version, modifies file in place
214+
bump_spec_version() {
215+
local file=$1
216+
local is_patch_release=$2
217+
218+
# Extract current spec_version from file (format: X_YYY_ZZZ)
219+
local current_spec=$(grep -oP 'spec_version:\s*\K[0-9]+_[0-9]+_[0-9]+' "$file" | head -1)
220+
221+
if [ -z "$current_spec" ]; then
222+
echo "⚠️ Warning: Could not find spec_version in $file"
223+
return 1
224+
fi
225+
226+
# Parse the spec_version (format: X_YYY_ZZZ)
227+
local major=$(echo "$current_spec" | cut -d'_' -f1)
228+
local minor=$(echo "$current_spec" | cut -d'_' -f2)
229+
local patch=$(echo "$current_spec" | cut -d'_' -f3)
230+
231+
# Remove leading zeros for arithmetic
232+
minor=$((10#$minor))
233+
patch=$((10#$patch))
234+
235+
if [ "$is_patch_release" = "true" ]; then
236+
# Patch release: bump patch part by 1
237+
patch=$((patch + 1))
238+
else
239+
# New stable release: bump minor by 1, reset patch to 0
240+
minor=$((minor + 1))
241+
patch=0
242+
fi
243+
244+
# Format back to X_YYY_ZZZ format (with proper zero padding)
245+
local new_spec=$(printf "%d_%03d_%03d" "$major" "$minor" "$patch")
246+
247+
# Replace in file
248+
sed -ri "s/spec_version: ${current_spec},/spec_version: ${new_spec},/" "$file"
249+
250+
echo "$new_spec"
251+
}

.github/workflows/release-20_build-rc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
validate-inputs:
2929
needs: [check-synchronization]
30-
if: ${{ needs.check-synchronization.outputs.checks_passed }} == 'true'
30+
if: needs.check-synchronization.outputs.checks_passed == 'true'
3131
runs-on: ubuntu-latest
3232
outputs:
3333
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release - Build runtimes
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
chain:
7+
description: The chain to use
8+
default: all
9+
required: true
10+
type: choice
11+
options:
12+
- all
13+
- westend
14+
- asset-hub-westend
15+
- bridge-hub-westend
16+
- collectives-westend
17+
- coretime-westend
18+
- glutton-westend
19+
- people-westend
20+
runtime_dir:
21+
description: The runtime dir to be used (⚠️ this parameter is optional and needed only in case of the single runtime build, set it accordingly to the runtime you want to build)
22+
default: polkadot/runtime/westend
23+
type: choice
24+
options:
25+
- polkadot/runtime/westend
26+
- cumulus/parachains/runtimes/assets/asset-hub-westend
27+
- cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend
28+
- cumulus/parachains/runtimes/collectives/collectives-westend
29+
- cumulus/parachains/runtimes/coretime/coretime-westend
30+
- cumulus/parachains/runtimes/people/people-westend
31+
- cumulus/parachains/runtimes/glutton/glutton-westend
32+
33+
release_tag:
34+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcY or polkadot-stableYYMM(-X)
35+
type: string
36+
37+
workflow_call:
38+
inputs:
39+
chain:
40+
description: The chain to use
41+
default: all
42+
required: true
43+
type: string
44+
runtime_dir:
45+
description: The runtime dir to be used (⚠️ this parameter is optional and needed only in case of the single runtime build, set it accordingly to the runtime you want to build)
46+
default: polkadot/runtime/westend
47+
type: string
48+
release_tag:
49+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcY or polkadot-stableYYMM(-X)
50+
type: string
51+
outputs:
52+
published_runtimes:
53+
value: ${{ jobs.build-runtimes.outputs.published_runtimes }}
54+
55+
jobs:
56+
check-synchronization:
57+
uses: paritytech-release/sync-workflows/.github/workflows/check-synchronization.yml@main
58+
secrets:
59+
fork_writer_app_key: ${{ secrets.UPSTREAM_CONTENT_SYNC_APP_KEY }}
60+
61+
validate-inputs:
62+
needs: [check-synchronization]
63+
if: needs.check-synchronization.outputs.checks_passed == 'true'
64+
runs-on: ubuntu-latest
65+
outputs:
66+
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}
67+
steps:
68+
- name: Checkout sources
69+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
70+
71+
- name: Validate inputs
72+
id: validate_inputs
73+
run: |
74+
. ./.github/scripts/common/lib.sh
75+
76+
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
77+
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
78+
79+
build-runtimes:
80+
needs: [validate-inputs]
81+
uses: "./.github/workflows/release-srtool.yml"
82+
with:
83+
excluded_runtimes: "rococo asset-hub-rococo bridge-hub-rococo rococo substrate-test bp cumulus-test kitchensink minimal-template parachain-template penpal polkadot-test seedling shell frame-try sp solochain-template polkadot-sdk-docs-first pallet-staking-async-parachain pallet-staking-async-rc frame-storage-access-test yet-another-parachain revive-dev"
84+
build_opts: "--features on-chain-release-build"
85+
profile: production
86+
chain: ${{ inputs.chain }}
87+
runtime_dir: ${{ inputs.runtime_dir }}
88+
permissions:
89+
id-token: write
90+
attestations: write
91+
contents: read
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Release - Combined Builds Flow
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
chain:
7+
description: The chain to use for runtime builds
8+
default: all
9+
required: true
10+
type: choice
11+
options:
12+
- all
13+
- westend
14+
- asset-hub-westend
15+
- bridge-hub-westend
16+
- collectives-westend
17+
- coretime-westend
18+
- glutton-westend
19+
- people-westend
20+
runtime_dir:
21+
description: The runtime dir to be used (⚠️ this parameter is optional and needed only in case of the single runtime build, set it accordingly to the runtime you want to build)
22+
default: polkadot/runtime/westend
23+
type: choice
24+
options:
25+
- polkadot/runtime/westend
26+
- cumulus/parachains/runtimes/assets/asset-hub-westend
27+
- cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend
28+
- cumulus/parachains/runtimes/collectives/collectives-westend
29+
- cumulus/parachains/runtimes/coretime/coretime-westend
30+
- cumulus/parachains/runtimes/people/people-westend
31+
- cumulus/parachains/runtimes/glutton/glutton-westend
32+
binary:
33+
description: Binary to be built for the release candidate
34+
default: all
35+
type: choice
36+
options:
37+
- polkadot
38+
- polkadot-parachain
39+
- polkadot-omni-node
40+
- frame-omni-bencher
41+
- chain-spec-builder
42+
- substrate-node
43+
- eth-rpc
44+
- subkey
45+
- all
46+
release_tag:
47+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcY or polkadot-stableYYMM(-X)
48+
type: string
49+
required: true
50+
no_runtimes:
51+
description: If true, no runtime build will be triggered and release draft will be published without runtimes (⚠️ use it for the patch releases of the latest stable)
52+
required: true
53+
type: boolean
54+
default: false
55+
56+
jobs:
57+
check-synchronization:
58+
uses: paritytech-release/sync-workflows/.github/workflows/check-synchronization.yml@main
59+
secrets:
60+
fork_writer_app_key: ${{ secrets.UPSTREAM_CONTENT_SYNC_APP_KEY }}
61+
62+
validate-inputs:
63+
needs: [check-synchronization]
64+
if: needs.check-synchronization.outputs.checks_passed == 'true'
65+
runs-on: ubuntu-latest
66+
outputs:
67+
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}
68+
steps:
69+
- name: Checkout sources
70+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
71+
72+
- name: Validate inputs
73+
id: validate_inputs
74+
run: |
75+
. ./.github/scripts/common/lib.sh
76+
77+
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
78+
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
79+
80+
build-runtimes-flow:
81+
if: ${{ inputs.no_runtimes == false }}
82+
needs: [validate-inputs]
83+
uses: "./.github/workflows/release-21_build-runtimes.yml"
84+
with:
85+
chain: ${{ inputs.chain }}
86+
runtime_dir: ${{ inputs.runtime_dir }}
87+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
88+
secrets: inherit
89+
permissions:
90+
id-token: write
91+
attestations: write
92+
contents: read
93+
94+
build-rc-flow:
95+
needs: [validate-inputs]
96+
uses: "./.github/workflows/release-20_build-rc.yml"
97+
with:
98+
binary: ${{ inputs.binary }}
99+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
100+
secrets: inherit
101+
permissions:
102+
id-token: write
103+
attestations: write
104+
contents: read
105+
106+
trigger-release-draft-with-runtimes:
107+
if: ${{ inputs.no_runtimes == false }}
108+
needs: [build-runtimes-flow, build-rc-flow, validate-inputs]
109+
uses: "./.github/workflows/release-30_publish_release_draft.yml"
110+
with:
111+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
112+
build_run_id: ${{ github.run_id }}
113+
runtimes: '${{ needs.build-runtimes-flow.outputs.published_runtimes }}'
114+
no_runtimes: ${{ inputs.no_runtimes }}
115+
crates_only: false
116+
secrets: inherit
117+
118+
trigger-release-draft-without-runtimes:
119+
if: ${{ inputs.no_runtimes == true }}
120+
needs: [build-rc-flow, validate-inputs]
121+
uses: "./.github/workflows/release-30_publish_release_draft.yml"
122+
with:
123+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
124+
build_run_id: ${{ github.run_id }}
125+
no_runtimes: ${{ inputs.no_runtimes }}
126+
crates_only: false
127+
secrets: inherit

.github/workflows/release-30_publish_release_draft.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
validate-inputs:
2626
needs: [ check-synchronization ]
27-
if: ${{ needs.check-synchronization.outputs.checks_passed }} == 'true'
27+
if: needs.check-synchronization.outputs.checks_passed == 'true'
2828
runs-on: ubuntu-latest
2929
outputs:
3030
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}

.github/workflows/release-31_promote-rc-to-final.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
validate-inputs:
3030
needs: [ check-synchronization ]
31-
if: ${{ needs.check-synchronization.outputs.checks_passed }} == 'true'
31+
if: needs.check-synchronization.outputs.checks_passed == 'true'
3232
runs-on: ubuntu-latest
3333
outputs:
3434
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}

.github/workflows/release-40_publish-deb-package.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: paritytech-release/sync-workflows/.github/workflows/check-synchronization.yml@main
2121
secrets:
2222
fork_writer_app_key: ${{ secrets.UPSTREAM_CONTENT_SYNC_APP_KEY }}
23+
<<<<<<< HEAD
2324

2425
validate-inputs:
2526
needs: [check-synchronization]
@@ -152,3 +153,16 @@ jobs:
152153
153154
# Invalidate caches to make sure latest files are served
154155
aws cloudfront create-invalidation --distribution-id E36FKEYWDXAZYJ --paths '/deb/*'
156+
=======
157+
call-publish-workflow:
158+
needs: [check-synchronization]
159+
if: needs.check-synchronization.outputs.checks_passed == 'true'
160+
uses: ./.github/workflows/release-reusable-publish-packages.yml
161+
with:
162+
tag: ${{ inputs.tag }}
163+
distribution: ${{ inputs.distribution }}
164+
package_type: 'deb'
165+
aws_repo_base_path: "s3://releases-package-repos"
166+
cloudfront_distribution_id: "E36FKEYWDXAZYJ"
167+
secrets: inherit
168+
>>>>>>> 97e54c54 ([CI|Release] Improve post crates action (#10803))

0 commit comments

Comments
 (0)