Skip to content

Commit 2ffd843

Browse files
[stable2512] Backport #11116 (#11124)
Backport #11116 into `stable2512` from EgorPopelyaev. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> --------- Co-authored-by: Egor_P <egor@parity.io>
1 parent d326a2a commit 2ffd843

16 files changed

+241
-118
lines changed

.github/workflows/release-10_branchoff-stable.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ jobs:
3737

3838
- name: Validate inputs
3939
id: validate_inputs
40+
env:
41+
INPUT_NODE_VERSION: ${{ inputs.node_version }}
42+
INPUT_STABLE_VERSION: ${{ inputs.stable_version }}
4043
run: |
4144
. ./.github/scripts/common/lib.sh
4245
43-
if [ -n "${{ inputs.node_version }}" ]; then
44-
node_version=$(filter_version_from_input "${{ inputs.node_version }}")
46+
if [ -n "$INPUT_NODE_VERSION" ]; then
47+
node_version=$(filter_version_from_input "$INPUT_NODE_VERSION")
4548
echo "node_version=${node_version}" >> $GITHUB_OUTPUT
4649
fi
4750
48-
stable_version=$(validate_stable_tag ${{ inputs.stable_version }})
51+
stable_version=$(validate_stable_tag "$INPUT_STABLE_VERSION")
4952
echo "stable_version=${stable_version}" >> $GITHUB_OUTPUT
5053
5154
create-stable-branch:
@@ -103,10 +106,10 @@ jobs:
103106
- name: Bump versions, reorder prdocs and push stable branch
104107
env:
105108
GH_TOKEN: ${{ steps.generate_write_token.outputs.token }}
109+
NODE_VERSION: ${{ needs.validate-inputs.outputs.node_version }}
106110
run: |
107111
. ./.github/scripts/release/release_lib.sh
108112
109-
NODE_VERSION="${{ needs.validate-inputs.outputs.node_version }}"
110113
NODE_VERSION_PATTERN="\(NODE_VERSION[^=]*= \)\".*\""
111114
set_version "$NODE_VERSION_PATTERN" $NODE_VERSION "polkadot/node/primitives/src/lib.rs"
112115
commit_with_message "Bump node version to $NODE_VERSION in polkadot-cli"
@@ -127,12 +130,14 @@ jobs:
127130
if: ${{ inputs.tag_rc }}
128131
env:
129132
GH_TOKEN: ${{ steps.generate_write_token.outputs.token }} # or use a PAT with workflow scope
133+
STABLE_VERSION: ${{ needs.validate-inputs.outputs.stable_version }}
134+
GH_REPOSITORY: ${{ github.repository }}
130135
run: |
131-
stable_tag_base=polkadot-${{ needs.validate-inputs.outputs.stable_version }}
136+
stable_tag_base="polkadot-${STABLE_VERSION}"
132137
gh workflow run release-11_rc-automation.yml \
133-
--repo ${{ github.repository }} \
134-
--ref ${{ needs.validate-inputs.outputs.stable_version }} \
135-
--field version=${stable_tag_base}
138+
--repo "$GH_REPOSITORY" \
139+
--ref "$STABLE_VERSION" \
140+
--field version="${stable_tag_base}"
136141
137142
tag-rc-without-branchoff:
138143
if: ${{ !inputs.is_new_stable && inputs.tag_rc }}

.github/workflows/release-11_rc-automation.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ jobs:
6464
# if: ${{ steps.get_rel_product.outputs.product == 'polkadot' }}
6565
id: compute_tag
6666
shell: bash
67+
env:
68+
INPUT_VERSION: ${{ inputs.version }}
6769
run: |
6870
. ./.github/scripts/common/lib.sh
6971
7072
# Get last rc tag if exists, else set it to {version}-rc1
71-
if [[ -z "${{ inputs.version }}" ]]; then
73+
if [[ -z "$INPUT_VERSION" ]]; then
7274
version=v$(get_polkadot_node_version_from_code)
7375
else
74-
version=$(validate_stable_tag ${{ inputs.version }})
76+
version=$(validate_stable_tag "$INPUT_VERSION")
7577
fi
7678
echo "$version"
7779
echo "version=$version" >> $GITHUB_OUTPUT

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ jobs:
5151

5252
- name: Validate inputs
5353
id: validate_inputs
54+
env:
55+
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
5456
run: |
5557
. ./.github/scripts/common/lib.sh
5658
57-
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
59+
RELEASE_TAG=$(validate_stable_tag "$INPUT_RELEASE_TAG")
5860
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
5961
6062
build-polkadot-binary:

.github/workflows/release-21_build-runtimes.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ jobs:
7070

7171
- name: Validate inputs
7272
id: validate_inputs
73+
env:
74+
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
7375
run: |
7476
. ./.github/scripts/common/lib.sh
7577
76-
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
78+
RELEASE_TAG=$(validate_stable_tag "$INPUT_RELEASE_TAG")
7779
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
7880
7981
build-runtimes:

.github/workflows/release-22_combined-rc-runtime-builds-release-draft.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ jobs:
7171

7272
- name: Validate inputs
7373
id: validate_inputs
74+
env:
75+
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
7476
run: |
7577
. ./.github/scripts/common/lib.sh
7678
77-
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
79+
RELEASE_TAG=$(validate_stable_tag "$INPUT_RELEASE_TAG")
7880
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
7981
8082
build-runtimes-flow:

.github/workflows/release-30_publish_release_draft.yml

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ jobs:
7474

7575
- name: Validate inputs
7676
id: validate_inputs
77+
env:
78+
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
7779
run: |
7880
. ./.github/scripts/common/lib.sh
7981
80-
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
82+
RELEASE_TAG=$(validate_stable_tag "$INPUT_RELEASE_TAG")
8183
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
8284
8385
@@ -106,10 +108,11 @@ jobs:
106108
if: ${{ inputs.no_runtimes == false && inputs.crates_only == false }}
107109
env:
108110
GITHUB_TOKEN: ${{ steps.generate_write_token.outputs.token }}
111+
BUILD_RUN_ID: ${{ inputs.build_run_id }}
109112
run: |
110-
mkdir -p ${{ github.workspace}}/runtimes/
111-
gh run download ${{ inputs.build_run_id }} --dir ${{ github.workspace}}/runtimes
112-
ls -la ${{ github.workspace}}/runtimes
113+
mkdir -p "${GITHUB_WORKSPACE}/runtimes/"
114+
gh run download "$BUILD_RUN_ID" --dir "${GITHUB_WORKSPACE}/runtimes"
115+
ls -la "${GITHUB_WORKSPACE}/runtimes"
113116
114117
- name: Prepare tooling
115118
run: |
@@ -131,6 +134,7 @@ jobs:
131134
RELEASE_TAG: ${{ needs.validate-inputs.outputs.release_tag }}
132135
NO_RUNTIMES: ${{ inputs.no_runtimes }}
133136
CRATES_ONLY: ${{ inputs.crates_only }}
137+
GH_REF_NAME: ${{ github.ref_name }}
134138
shell: bash
135139
run: |
136140
. ./.github/scripts/common/lib.sh
@@ -139,7 +143,7 @@ jobs:
139143
140144
export REF1=$(get_latest_release_tag)
141145
if [[ -z "$RELEASE_TAG" ]]; then
142-
export REF2="${{ github.ref_name }}"
146+
export REF2="${GH_REF_NAME}"
143147
echo "REF2: ${REF2}"
144148
else
145149
export REF2="$RELEASE_TAG"
@@ -203,28 +207,32 @@ jobs:
203207
- name: Download runtimes
204208
env:
205209
GITHUB_TOKEN: ${{ steps.generate_write_token.outputs.token }}
210+
BUILD_RUN_ID: ${{ inputs.build_run_id }}
206211
run: |
207-
mkdir -p ${{ github.workspace}}/runtimes/
208-
gh run download ${{ inputs.build_run_id }} --dir ${{ github.workspace}}/runtimes
209-
ls -la ${{ github.workspace}}/runtimes
212+
mkdir -p "${GITHUB_WORKSPACE}/runtimes/"
213+
gh run download "$BUILD_RUN_ID" --dir "${GITHUB_WORKSPACE}/runtimes"
214+
ls -la "${GITHUB_WORKSPACE}/runtimes"
210215
211216
- name: Get runtime info
212217
env:
218+
CHAIN: ${{ matrix.chain }}
213219
JSON: ${{ github.workspace}}/release-notes-context/runtimes/${{ matrix.chain }}-runtime/${{ matrix.chain }}-srtool-digest.json
214220
run: |
215-
cd ${{ github.workspace}}/runtimes
216-
>>$GITHUB_ENV echo ASSET=$(find ${{ matrix.chain }}-runtime -name '*.compact.compressed.wasm')
221+
cd "${GITHUB_WORKSPACE}/runtimes"
222+
>>$GITHUB_ENV echo ASSET=$(find "${CHAIN}-runtime" -name '*.compact.compressed.wasm')
217223
>>$GITHUB_ENV echo SPEC=$(<${JSON} jq -r .runtimes.compact.subwasm.core_version.specVersion)
218224
219225
- name: Upload compressed ${{ matrix.chain }} v${{ env.SPEC }} wasm
220226
working-directory: ${{ github.workspace}}/runtimes
221227
env:
222228
GITHUB_TOKEN: ${{ steps.generate_write_token.outputs.token }}
229+
CHAIN: ${{ matrix.chain }}
230+
VALIDATED_RELEASE_TAG: ${{ needs.validate-inputs.outputs.release_tag }}
223231
run: |
224-
VERSIONED_ASSET="${{ matrix.chain }}_runtime-v${{ env.SPEC }}.compact.compressed.wasm"
232+
VERSIONED_ASSET="${CHAIN}_runtime-v${{ env.SPEC }}.compact.compressed.wasm"
225233
mv "${{ env.ASSET }}" "$VERSIONED_ASSET"
226234
227-
gh release upload ${{ needs.validate-inputs.outputs.release_tag }} \
235+
gh release upload "$VALIDATED_RELEASE_TAG" \
228236
--repo paritytech/polkadot-sdk "$VERSIONED_ASSET"
229237
230238
publish-release-artifacts:
@@ -243,23 +251,28 @@ jobs:
243251
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
244252

245253
- name: Fetch binaries from s3 based on version
254+
env:
255+
VERSION: ${{ needs.validate-inputs.outputs.release_tag }}
256+
BINARY: ${{ matrix.binary }}
257+
TARGET: ${{ matrix.target }}
246258
run: |
247259
. ./.github/scripts/common/lib.sh
248260
249-
VERSION="${{ needs.validate-inputs.outputs.release_tag }}"
250-
fetch_release_artifacts_from_s3 ${{ matrix.binary }} ${{ matrix.target }}
261+
fetch_release_artifacts_from_s3 "$BINARY" "$TARGET"
251262
252263
- name: Rename aarch64-apple-darwin binaries
253264
if: ${{ matrix.target == 'aarch64-apple-darwin' }}
254265
working-directory: ${{ github.workspace}}/release-artifacts/${{ matrix.target }}/${{ matrix.binary }}
266+
env:
267+
BINARY: ${{ matrix.binary }}
255268
run: |
256269
. ../../../.github/scripts/common/lib.sh
257270
258-
mv ${{ matrix.binary }} ${{ matrix.binary }}-aarch64-apple-darwin
259-
mv ${{ matrix.binary }}.asc ${{ matrix.binary }}-aarch64-apple-darwin.asc
271+
mv "$BINARY" "${BINARY}-aarch64-apple-darwin"
272+
mv "${BINARY}.asc" "${BINARY}-aarch64-apple-darwin.asc"
260273
261-
sha256sum "${{ matrix.binary }}-aarch64-apple-darwin" | tee "${{ matrix.binary }}-aarch64-apple-darwin.sha256"
262-
check_sha256 "${{ matrix.binary }}-aarch64-apple-darwin" && echo "OK" || echo "ERR"
274+
sha256sum "${BINARY}-aarch64-apple-darwin" | tee "${BINARY}-aarch64-apple-darwin.sha256"
275+
check_sha256 "${BINARY}-aarch64-apple-darwin" && echo "OK" || echo "ERR"
263276
264277
- name: Generate content write token for the release automation
265278
id: generate_write_token
@@ -273,20 +286,23 @@ jobs:
273286
- name: Upload ${{ matrix.binary }} binary to release draft
274287
env:
275288
GITHUB_TOKEN: ${{ steps.generate_write_token.outputs.token }}
289+
BINARY: ${{ matrix.binary }}
290+
TARGET: ${{ matrix.target }}
291+
VALIDATED_RELEASE_TAG: ${{ needs.validate-inputs.outputs.release_tag }}
276292
working-directory: ${{ github.workspace}}/release-artifacts/${{ matrix.target }}/${{ matrix.binary }}
277293
run: |
278-
if [[ ${{ matrix.target }} == "aarch64-apple-darwin" ]]; then
279-
gh release upload ${{ needs.validate-inputs.outputs.release_tag }} \
294+
if [[ "$TARGET" == "aarch64-apple-darwin" ]]; then
295+
gh release upload "$VALIDATED_RELEASE_TAG" \
280296
--repo paritytech/polkadot-sdk \
281-
${{ matrix.binary }}-aarch64-apple-darwin \
282-
${{ matrix.binary }}-aarch64-apple-darwin.asc \
283-
${{ matrix.binary }}-aarch64-apple-darwin.sha256
297+
"${BINARY}-aarch64-apple-darwin" \
298+
"${BINARY}-aarch64-apple-darwin.asc" \
299+
"${BINARY}-aarch64-apple-darwin.sha256"
284300
else
285-
gh release upload ${{ needs.validate-inputs.outputs.release_tag }} \
301+
gh release upload "$VALIDATED_RELEASE_TAG" \
286302
--repo paritytech/polkadot-sdk \
287-
${{ matrix.binary }} \
288-
${{ matrix.binary }}.asc \
289-
${{ matrix.binary }}.sha256
303+
"$BINARY" \
304+
"${BINARY}.asc" \
305+
"${BINARY}.sha256"
290306
fi
291307
292308
post_to_matrix:

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ jobs:
5555

5656
- name: Validate inputs
5757
id: validate_inputs
58+
env:
59+
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
5860
run: |
5961
. ./.github/scripts/common/lib.sh
6062
61-
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
63+
RELEASE_TAG=$(validate_stable_tag "$INPUT_RELEASE_TAG")
6264
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
6365
6466
# Calculate final tag by removing -rc suffix

.github/workflows/release-50_publish-docker.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,16 @@ jobs:
119119

120120
- name: Validate inputs
121121
id: validate_inputs
122+
env:
123+
INPUT_VERSION: ${{ inputs.version }}
124+
INPUT_STABLE_TAG: ${{ inputs.stable_tag }}
122125
run: |
123126
. ./.github/scripts/common/lib.sh
124127
125-
VERSION=$(filter_version_from_input "${{ inputs.version }}")
128+
VERSION=$(filter_version_from_input "$INPUT_VERSION")
126129
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
127130
128-
STABLE_TAG=$(validate_stable_tag ${{ inputs.stable_tag }})
131+
STABLE_TAG=$(validate_stable_tag "$INPUT_STABLE_TAG")
129132
echo "stable_tag=${STABLE_TAG}" >> $GITHUB_OUTPUT
130133
131134
fetch-artifacts: # this job will be triggered for the polkadot-parachain rc and release or polkadot rc image build
@@ -139,11 +142,12 @@ jobs:
139142

140143
- name: Fetch rc artifacts or release artifacts from s3 based on version
141144
if: ${{ inputs.binary == 'polkadot-omni-node' || inputs.binary == 'polkadot-parachain' || inputs.binary == 'chain-spec-builder' || inputs.image_type == 'rc' }}
145+
env:
146+
VERSION: ${{ needs.validate-inputs.outputs.stable_tag }}
142147
run: |
143148
. ./.github/scripts/common/lib.sh
144149
145-
VERSION="${{ needs.validate-inputs.outputs.stable_tag }}"
146-
if [[ ${{ inputs.binary }} == 'polkadot' ]]; then
150+
if [[ "$BINARY" == 'polkadot' ]]; then
147151
bins=(polkadot polkadot-prepare-worker polkadot-execute-worker)
148152
for bin in "${bins[@]}"; do
149153
fetch_release_artifacts_from_s3 $bin x86_64-unknown-linux-gnu
@@ -197,24 +201,30 @@ jobs:
197201
if: ${{ env.IMAGE_TYPE == 'rc' }}
198202
id: fetch_rc_refs
199203
shell: bash
204+
env:
205+
VALIDATED_VERSION: ${{ needs.validate-inputs.outputs.version }}
206+
VALIDATED_STABLE_TAG: ${{ needs.validate-inputs.outputs.stable_tag }}
200207
run: |
201208
. ../.github/scripts/common/lib.sh
202209
203210
commit=$(git rev-parse --short HEAD) && \
204211
echo "commit=${commit}" >> $GITHUB_OUTPUT
205-
echo "release=$(echo ${{ needs.validate-inputs.outputs.version }})" >> $GITHUB_OUTPUT
206-
echo "tag=$(prepare_docker_stable_tag ${{ needs.validate-inputs.outputs.stable_tag }})" >> $GITHUB_OUTPUT
212+
echo "release=${VALIDATED_VERSION}" >> $GITHUB_OUTPUT
213+
echo "tag=$(prepare_docker_stable_tag "$VALIDATED_STABLE_TAG")" >> $GITHUB_OUTPUT
207214
208215
- name: Fetch release tags
209216
if: ${{ env.IMAGE_TYPE == 'release'}}
210217
id: fetch_release_refs
211218
shell: bash
219+
env:
220+
VALIDATED_VERSION: ${{ needs.validate-inputs.outputs.version }}
221+
VALIDATED_STABLE_TAG: ${{ needs.validate-inputs.outputs.stable_tag }}
212222
run: |
213223
. .github/scripts/common/lib.sh
214224
215225
echo "tag=latest" >> $GITHUB_OUTPUT
216-
echo "release=$(echo ${{ needs.validate-inputs.outputs.version }})" >> $GITHUB_OUTPUT
217-
echo "stable=$(prepare_docker_stable_tag ${{ needs.validate-inputs.outputs.stable_tag }})" >> $GITHUB_OUTPUT
226+
echo "release=${VALIDATED_VERSION}" >> $GITHUB_OUTPUT
227+
echo "stable=$(prepare_docker_stable_tag "$VALIDATED_STABLE_TAG")" >> $GITHUB_OUTPUT
218228
219229
- name: Build Injected Container image for polkadot
220230
if: ${{ env.BINARY == 'polkadot' }}
@@ -223,13 +233,14 @@ jobs:
223233
IMAGE_NAME: ${{ env.BINARY }}
224234
OWNER: ${{ env.DOCKER_OWNER }}
225235
TAGS: ${{ join(steps.fetch_rc_refs.outputs.*, ',') || join(steps.fetch_release_refs.outputs.*, ',') }}
236+
VALIDATED_VERSION: ${{ needs.validate-inputs.outputs.version }}
226237
shell: bash
227238
run: |
228239
ls -al
229240
echo "Building container for $BINARY"
230-
echo "IMAGE_TYPE: ${{ inputs.image_type }}"
241+
echo "IMAGE_TYPE: $IMAGE_TYPE"
231242
232-
if [[ "${{ inputs.image_type }}" == "rc" ]]; then
243+
if [[ "$IMAGE_TYPE" == "rc" ]]; then
233244
echo "Building RC container for polkadot"
234245
export DOCKERFILE="docker/dockerfiles/polkadot/polkadot_injected.Dockerfile"
235246
export BINARY="polkadot,polkadot-execute-worker,polkadot-prepare-worker"
@@ -239,7 +250,7 @@ jobs:
239250
export DOCKERFILE="docker/dockerfiles/polkadot/polkadot_injected_debian.Dockerfile"
240251
export BINARY="polkadot,polkadot-execute-worker,polkadot-prepare-worker"
241252
export POLKADOT_DEB=true
242-
export VERSION=${{ needs.validate-inputs.outputs.version }}
253+
export VERSION="$VALIDATED_VERSION"
243254
./docker/scripts/build-injected.sh
244255
fi
245256

0 commit comments

Comments
 (0)