Skip to content

Commit adf7380

Browse files
[stable2412] Backport backport #6748 (#6753)
Backport #6748 into `stable2412`
1 parent 6f5f7ce commit adf7380

File tree

6 files changed

+253
-19
lines changed

6 files changed

+253
-19
lines changed

.github/scripts/common/lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ fetch_release_artifacts_from_s3() {
297297
pwd
298298
ls -al --color
299299
popd > /dev/null
300-
300+
unset OUTPUT_DIR
301301
}
302302

303303
# Pass the name of the binary as input, it will

.github/scripts/release/release_lib.sh

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,17 @@ upload_s3_release() {
129129
echo "Working on version: $version "
130130
echo "Working on platform: $target "
131131

132+
URL_BASE=$(get_s3_url_base $product)
133+
132134
echo "Current content, should be empty on new uploads:"
133-
aws s3 ls "s3://releases.parity.io/${product}/${version}/${target}" --recursive --human-readable --summarize || true
135+
aws s3 ls "s3://${URL_BASE}/${version}/${target}" --recursive --human-readable --summarize || true
134136
echo "Content to be uploaded:"
135-
artifacts="artifacts/$product/"
137+
artifacts="release-artifacts/$target/$product/"
136138
ls "$artifacts"
137-
aws s3 sync --acl public-read "$artifacts" "s3://releases.parity.io/${product}/${version}/${target}"
139+
aws s3 sync --acl public-read "$artifacts" "s3://${URL_BASE}/${version}/${target}"
138140
echo "Uploaded files:"
139-
aws s3 ls "s3://releases.parity.io/${product}/${version}/${target}" --recursive --human-readable --summarize
140-
echo "✅ The release should be at https://releases.parity.io/${product}/${version}/${target}"
141+
aws s3 ls "s3://${URL_BASE}/${version}/${target}" --recursive --human-readable --summarize
142+
echo "✅ The release should be at https://${URL_BASE}/${version}/${target}"
141143
}
142144

143145
# Upload runtimes artifacts to s3 release bucket
@@ -161,3 +163,35 @@ upload_s3_runtimes_release_artifacts() {
161163
aws s3 ls "s3://releases.parity.io/polkadot/runtimes/${version}/" --recursive --human-readable --summarize
162164
echo "✅ The release should be at https://releases.parity.io/polkadot/runtimes/${version}"
163165
}
166+
167+
168+
# Pass the name of the binary as input, it will
169+
# return the s3 base url
170+
function get_s3_url_base() {
171+
name=$1
172+
case $name in
173+
polkadot | polkadot-execute-worker | polkadot-prepare-worker )
174+
printf "releases.parity.io/polkadot"
175+
;;
176+
177+
polkadot-parachain)
178+
printf "releases.parity.io/polkadot-parachain"
179+
;;
180+
181+
polkadot-omni-node)
182+
printf "releases.parity.io/polkadot-omni-node"
183+
;;
184+
185+
chain-spec-builder)
186+
printf "releases.parity.io/chain-spec-builder"
187+
;;
188+
189+
frame-omni-bencher)
190+
printf "releases.parity.io/frame-omni-bencher"
191+
;;
192+
*)
193+
printf "UNSUPPORTED BINARY $name"
194+
exit 1
195+
;;
196+
esac
197+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Release - Promote RC to final candidate on S3
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
binary:
7+
description: Binary to be build for the release
8+
default: all
9+
type: choice
10+
options:
11+
- polkadot
12+
- polkadot-parachain
13+
- polkadot-omni-node
14+
- frame-omni-bencher
15+
- chain-spec-builder
16+
- all
17+
release_tag:
18+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcX
19+
type: string
20+
21+
22+
jobs:
23+
24+
check-synchronization:
25+
uses: paritytech-release/sync-workflows/.github/workflows/check-syncronization.yml@main
26+
27+
validate-inputs:
28+
needs: [ check-synchronization ]
29+
if: ${{ needs.check-synchronization.outputs.checks_passed }} == 'true'
30+
runs-on: ubuntu-latest
31+
outputs:
32+
release_tag: ${{ steps.validate_inputs.outputs.release_tag }}
33+
final_tag: ${{ steps.validate_inputs.outputs.final_tag }}
34+
35+
steps:
36+
- name: Checkout sources
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
39+
- name: Validate inputs
40+
id: validate_inputs
41+
run: |
42+
. ./.github/scripts/common/lib.sh
43+
44+
RELEASE_TAG=$(validate_stable_tag ${{ inputs.release_tag }})
45+
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
46+
47+
promote-polkadot-rc-to-final:
48+
if: ${{ inputs.binary == 'polkadot' || inputs.binary == 'all' }}
49+
needs: [ validate-inputs ]
50+
uses: ./.github/workflows/release-reusable-promote-to-final.yml
51+
strategy:
52+
matrix:
53+
target: [ x86_64-unknown-linux-gnu, aarch64-apple-darwin ]
54+
with:
55+
package: polkadot
56+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
57+
target: ${{ matrix.target }}
58+
secrets:
59+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
60+
AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
61+
AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
62+
63+
promote-polkadot-parachain-rc-to-final:
64+
if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'all' }}
65+
needs: [ validate-inputs ]
66+
uses: ./.github/workflows/release-reusable-promote-to-final.yml
67+
strategy:
68+
matrix:
69+
target: [ x86_64-unknown-linux-gnu, aarch64-apple-darwin ]
70+
with:
71+
package: polkadot-parachain
72+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
73+
target: ${{ matrix.target }}
74+
secrets:
75+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
76+
AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
77+
AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
78+
79+
promote-polkadot-omni-node-rc-to-final:
80+
if: ${{ inputs.binary == 'polkadot-omni-node' || inputs.binary == 'all' }}
81+
needs: [ validate-inputs ]
82+
uses: ./.github/workflows/release-reusable-promote-to-final.yml
83+
strategy:
84+
matrix:
85+
target: [ x86_64-unknown-linux-gnu, aarch64-apple-darwin ]
86+
with:
87+
package: polkadot-omni-node
88+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
89+
target: ${{ matrix.target }}
90+
secrets:
91+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
92+
AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
93+
AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
94+
95+
promote-frame-omni-bencher-rc-to-final:
96+
if: ${{ inputs.binary == 'frame-omni-bencher' || inputs.binary == 'all' }}
97+
needs: [ validate-inputs ]
98+
uses: ./.github/workflows/release-reusable-promote-to-final.yml
99+
strategy:
100+
matrix:
101+
target: [ x86_64-unknown-linux-gnu, aarch64-apple-darwin ]
102+
with:
103+
package: frame-omni-bencher
104+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
105+
target: ${{ matrix.target }}
106+
secrets:
107+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
108+
AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
109+
AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
110+
111+
promote-chain-spec-builder-rc-to-final:
112+
if: ${{ inputs.binary == 'chain-spec-builder' || inputs.binary == 'all' }}
113+
needs: [ validate-inputs ]
114+
uses: ./.github/workflows/release-reusable-promote-to-final.yml
115+
strategy:
116+
matrix:
117+
target: [ x86_64-unknown-linux-gnu, aarch64-apple-darwin ]
118+
with:
119+
package: chain-spec-builder
120+
release_tag: ${{ needs.validate-inputs.outputs.release_tag }}
121+
target: ${{ matrix.target }}
122+
secrets:
123+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
124+
AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
125+
AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Promote rc to final
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
package:
7+
description: Package to be promoted
8+
required: true
9+
type: string
10+
11+
release_tag:
12+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcX taht will be changed to final in form of polkadot-stableYYMM(-X)
13+
required: true
14+
type: string
15+
16+
target:
17+
description: Target triple for which the artifacts are being uploaded (e.g aarch64-apple-darwin)
18+
required: true
19+
type: string
20+
21+
secrets:
22+
AWS_DEFAULT_REGION:
23+
required: true
24+
AWS_RELEASE_ACCESS_KEY_ID:
25+
required: true
26+
AWS_RELEASE_SECRET_ACCESS_KEY:
27+
required: true
28+
29+
jobs:
30+
31+
promote-release-artifacts:
32+
environment: release
33+
runs-on: ubuntu-latest
34+
env:
35+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }}
36+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }}
37+
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
38+
39+
steps:
40+
- name: Checkout sources
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
43+
- name: Prepare final tag
44+
id: prepare_final_tag
45+
shell: bash
46+
run: |
47+
tag="$(echo ${{ inputs.release_tag }} | sed 's/-rc[0-9]*$//')"
48+
echo $tag
49+
echo "FINAL_TAG=${tag}" >> $GITHUB_OUTPUT
50+
51+
- name: Fetch binaries from s3 based on version
52+
run: |
53+
. ./.github/scripts/common/lib.sh
54+
55+
VERSION="${{ inputs.release_tag }}"
56+
if [[ ${{ inputs.package }} == 'polkadot' ]]; then
57+
packages=(polkadot polkadot-prepare-worker polkadot-execute-worker)
58+
for package in "${packages[@]}"; do
59+
fetch_release_artifacts_from_s3 $package ${{ inputs.target }}
60+
done
61+
else
62+
fetch_release_artifacts_from_s3 ${{ inputs.package }} ${{ inputs.target }}
63+
fi
64+
65+
- name: Configure AWS Credentials
66+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
67+
with:
68+
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
69+
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
70+
aws-region: ${{ env.AWS_REGION }}
71+
72+
- name: Upload ${{ inputs.package }} ${{ inputs.target }} artifacts to s3
73+
run: |
74+
. ./.github/scripts/release/release_lib.sh
75+
76+
if [[ ${{ inputs.package }} == 'polkadot' ]]; then
77+
packages=(polkadot polkadot-prepare-worker polkadot-execute-worker)
78+
for package in "${packages[@]}"; do
79+
upload_s3_release $package ${{ steps.prepare_final_tag.outputs.final_tag }} ${{ inputs.target }}
80+
done
81+
else
82+
upload_s3_release ${{ inputs.package }} ${{ steps.prepare_final_tag.outputs.final_tag }} ${{ inputs.target }}
83+
fi

.github/workflows/release-reusable-rc-buid.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
- name: Upload ${{ matrix.binaries }} artifacts
134134
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
135135
with:
136-
name: ${{ matrix.binaries }}
136+
name: ${{ matrix.binaries }}_${{ inputs.target }}
137137
path: /artifacts/${{ matrix.binaries }}
138138

139139
build-macos-rc:
@@ -285,7 +285,7 @@ jobs:
285285
- name: Upload ${{inputs.package }} artifacts
286286
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
287287
with:
288-
name: ${{ inputs.package }}
288+
name: ${{ inputs.package }}_${{ inputs.target }}
289289
path: target/production
290290
overwrite: true
291291

.github/workflows/release-reusable-s3-upload.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
type: string
1010

1111
release_tag:
12-
description: Tag matching the actual release candidate with the format stableYYMM-rcX or stableYYMM-rcX
12+
description: Tag matching the actual release candidate with the format polkadot-stableYYMM(-X)-rcX or polkadot-stableYYMM-rcX
1313
required: true
1414
type: string
1515

@@ -40,18 +40,10 @@ jobs:
4040
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
4141

4242
- name: Download amd64 artifacts
43-
if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' }}
4443
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
4544
with:
46-
name: ${{ inputs.package }}
47-
path: artifacts/${{ inputs.package }}
48-
49-
- name: Download arm artifacts
50-
if: ${{ inputs.target == 'aarch64-apple-darwin' }}
51-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
52-
with:
53-
name: ${{ inputs.package }}_aarch64-apple-darwin
54-
path: artifacts/${{ inputs.package }}
45+
name: ${{ inputs.package }}_${{ inputs.target }}
46+
path: release-artifacts/${{ inputs.target }}/${{ inputs.package }}
5547

5648
- name: Configure AWS Credentials
5749
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2

0 commit comments

Comments
 (0)