-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Release/CI] Github flow to build polkadot/polkadot-parachain rc binaries and deb package
#5963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 54 commits
668a114
b9621b1
ea371fa
5c216b2
b7b56c6
b05fc6f
20b5dbf
73874df
41b2b37
6c81ed7
af20353
b80d242
19afe85
9d6b12b
fca6718
dbbb141
80fe8f2
e104d72
ebab693
026f4af
63843cb
85b0691
83fd636
7f5cb2c
43c918c
73f40bb
8f42d25
f94a04f
0ae01e9
a96bf6f
1844de7
81d92a0
29c8515
be4ccdf
8085459
177d3da
745ab13
d9a17f1
04eeafe
54fac32
514cb53
c7792cd
a5a7ebb
666bd52
eab78f4
795c586
78e9df2
dfba403
4e2bb0a
f5b112a
b99fed1
87e0a6e
e7c96cf
c030fab
91bfeab
f599fd2
91103f9
31f52de
a7de7ba
025c5a6
eb34aec
4789c53
66a89c3
3c52c45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| PRODUCT=$1 | ||
| VERSION=$2 | ||
| PROFILE=${PROFILE:-production} | ||
|
|
||
| cargo install cargo-deb | ||
| echo "Using cargo-deb v$(cargo-deb --version)" | ||
| echo "Building a Debian package for '$PRODUCT' in '$PROFILE' profile" | ||
|
|
||
| cargo deb --profile $PROFILE --no-strip --no-build -p $PRODUCT --deb-version $VERSION | ||
|
|
||
| deb=target/debian/$PRODUCT_*_amd64.deb | ||
|
|
||
| cp $deb target/production/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This is used to build our binaries: | ||
| # - polkadot | ||
| # - polkadot-parachain | ||
| # set -e | ||
|
|
||
| BIN=$1 | ||
| PACKAGE=${2:-$BIN} | ||
|
|
||
| PROFILE=${PROFILE:-production} | ||
| RUST_TOOLCHAIN=stable | ||
|
||
| ARTIFACTS=/artifacts/$BIN | ||
| VERSION=$(git tag -l --contains HEAD | grep -E "^v.*") | ||
|
|
||
| echo "Artifacts will be copied into $ARTIFACTS" | ||
| mkdir -p "$ARTIFACTS" | ||
|
|
||
| git log --pretty=oneline -n 1 | ||
| time cargo build --profile $PROFILE --locked --verbose --bin $BIN --package $PACKAGE | ||
|
|
||
| echo "Artifact target: $ARTIFACTS" | ||
|
|
||
| cp ./target/$PROFILE/$BIN "$ARTIFACTS" | ||
| pushd "$ARTIFACTS" > /dev/nul | ||
| sha256sum "$BIN" | tee "$BIN.sha256" | ||
|
|
||
| EXTRATAG="$($ARTIFACTS/$BIN --version | | ||
| sed -n -r 's/^'$BIN' ([0-9.]+.*-[0-9a-f]{7,13})-.*$/\1/p')" | ||
|
|
||
| EXTRATAG="${VERSION}-${EXTRATAG}-$(cut -c 1-8 $ARTIFACTS/$BIN.sha256)" | ||
|
|
||
| echo "$BIN version = ${VERSION} (EXTRATAG = ${EXTRATAG})" | ||
| echo -n ${VERSION} > "$ARTIFACTS/VERSION" | ||
| echo -n ${EXTRATAG} > "$ARTIFACTS/EXTRATAG" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Release - Build node release candidate | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it safe/ok that anyone in org (even accidentally) can run this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't be the case, cause the setup is going so that it will be possible to trigger it only from the new paritytech-release org |
||
| inputs: | ||
| binary: | ||
| description: Binary to be build for the release | ||
| default: all | ||
| type: choice | ||
| options: | ||
| - polkadot | ||
| - polkadot-parachain | ||
| - all | ||
|
|
||
| release_tag: | ||
| description: Tag matching the actual release candidate with the format stableYYMM-rcX or stableYYMM | ||
| type: string | ||
|
|
||
| jobs: | ||
| # TODO: Activate this job when the pipeline is moved to the fork in the `paritytech-release` org | ||
| # check-workflow-can-run: | ||
| # uses: paritytech-release/sync-workflows/.github/workflows/check-syncronization.yml@latest | ||
|
|
||
| build-polkadot-binary: | ||
| # needs: [check-workflow-can-run] | ||
| if: ${{ inputs.binary == 'polkadot' || inputs.binary == 'all' }} | ||
| uses: "./.github/workflows/release-reusable-rc-buid.yml" | ||
| with: | ||
| binary: '["polkadot", "polkadot-prepare-worker", "polkadot-execute-worker"]' | ||
| package: polkadot | ||
| release_tag: ${{ inputs.release_tag }} | ||
| secrets: | ||
| PGP_KMS_KEY: ${{ secrets.PGP_KMS_KEY }} | ||
| PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }} | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
| AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} | ||
|
|
||
| build-polkadot-parachain-binary: | ||
| # needs: [check-workflow-can-run] | ||
| if: ${{ inputs.binary == 'polkadot-parachain' || inputs.binary == 'all' }} | ||
| uses: "./.github/workflows/release-reusable-rc-buid.yml" | ||
| with: | ||
| binary: '["polkadot-parachain"]' | ||
| package: "polkadot-parachain-bin" | ||
| release_tag: ${{ inputs.release_tag }} | ||
| secrets: | ||
| PGP_KMS_KEY: ${{ secrets.PGP_KMS_KEY }} | ||
| PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }} | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
| AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,190 @@ | ||
| name: RC Build | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| binary: | ||
| description: Binary to be build for the release | ||
| required: true | ||
| default: polkadot | ||
| type: string | ||
|
|
||
| package: | ||
| description: Package to be built, for now is either polkadot or polkadot-parachain-bin | ||
| required: true | ||
| type: string | ||
|
|
||
| release_tag: | ||
| description: Tag matching the actual release candidate with the format stableYYMM-rcX or stableYYMM | ||
| required: true | ||
| type: string | ||
|
|
||
| secrets: | ||
| PGP_KMS_KEY: | ||
| required: true | ||
| PGP_KMS_HASH: | ||
| required: true | ||
| AWS_ACCESS_KEY_ID: | ||
| required: true | ||
| AWS_SECRET_ACCESS_KEY: | ||
| required: true | ||
| AWS_DEFAULT_REGION: | ||
| required: true | ||
| AWS_RELEASE_ACCESS_KEY_ID: | ||
| required: true | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: | ||
| required: true | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| attestations: write | ||
|
|
||
| jobs: | ||
|
|
||
| set-image: | ||
| # GitHub Actions allows using 'env' in a container context. | ||
| # However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322 | ||
| # This workaround sets the container image for each job using 'set-image' job output. | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| IMAGE: ${{ steps.set_image.outputs.IMAGE }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
|
|
||
| - id: set_image | ||
| run: cat .github/env >> $GITHUB_OUTPUT | ||
|
|
||
| build-rc: | ||
| needs: [set-image] | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ${{ needs.set-image.outputs.IMAGE }} | ||
| strategy: | ||
| matrix: | ||
| binaries: ${{ fromJSON(inputs.binary) }} | ||
| env: | ||
| PGP_KMS_KEY: ${{ secrets.PGP_KMS_KEY }} | ||
| PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }} | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
|
||
| steps: | ||
| - name: Install pgpkkms | ||
| run: | | ||
| # Install pgpkms that is used to sign built artifacts | ||
| python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69" | ||
| which pgpkms | ||
|
|
||
| - name: Checkout sources | ||
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
| with: | ||
| ref: ${{ inputs.release_tag }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Import gpg keys | ||
| shell: bash | ||
| run: | | ||
| . ./.github/scripts/common/lib.sh | ||
|
|
||
| import_gpg_keys | ||
|
|
||
| - name: Build binary | ||
| run: | | ||
| git config --global --add safe.directory "${GITHUB_WORKSPACE}" #avoid "detected dubious ownership" error | ||
| ./.github/scripts/release/build-linux-release.sh ${{ matrix.binaries }} ${{ inputs.package }} | ||
|
|
||
| - name: Generate artifact attestation | ||
| uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | ||
| with: | ||
| subject-path: /artifacts/${{ matrix.binaries }}/${{ matrix.binaries }} | ||
|
|
||
| - name: Sign artifacts | ||
| working-directory: /artifacts/${{ matrix.binaries }} | ||
| run: | | ||
| python3 -m pgpkms sign --input ${{matrix.binaries }} -o ${{ matrix.binaries }}.asc | ||
|
|
||
| - name: Check sha256 ${{ matrix.binaries }} | ||
| working-directory: /artifacts/${{ matrix.binaries }} | ||
| shell: bash | ||
| run: | | ||
| . "${GITHUB_WORKSPACE}"/.github/scripts/common/lib.sh | ||
|
|
||
| echo "Checking binary ${{ matrix.binaries }}" | ||
| check_sha256 ${{ matrix.binaries }} && echo "OK" || echo "ERR" | ||
|
||
|
|
||
| - name: Check GPG ${{ matrix.binaries }} | ||
| working-directory: /artifacts/${{ matrix.binaries }} | ||
| shell: bash | ||
| run: | | ||
| . "${GITHUB_WORKSPACE}"/.github/scripts/common/lib.sh | ||
|
|
||
| check_gpg ${{ matrix.binaries }} | ||
|
|
||
| - name: Upload ${{ matrix.binaries }} artifacts | ||
| uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
| with: | ||
| name: ${{ matrix.binaries }} | ||
| path: /artifacts/${{ matrix.binaries }} | ||
|
|
||
| build-polkadot-deb-package: | ||
| if: ${{ inputs.package == 'polkadot' }} | ||
| needs: [build-rc] | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
| with: | ||
| ref: ${{ inputs.release_tag }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Download artifacts | ||
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
| with: | ||
| path: target/production | ||
| merge-multiple: true | ||
|
|
||
| - name: Build polkadot deb package | ||
| shell: bash | ||
| run: | | ||
| . "${GITHUB_WORKSPACE}"/.github/scripts/release/build-deb.sh ${{ inputs.package }} ${{ inputs.release_tag }} | ||
|
|
||
| - name: Generate artifact attestation | ||
| uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | ||
| with: | ||
| subject-path: target/production/*.deb | ||
|
|
||
| - name: Upload ${{inputs.package }} artifacts | ||
| uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
| with: | ||
| name: ${{ inputs.package }} | ||
| path: target/production | ||
| overwrite: true | ||
|
|
||
| upload-polkadot-artifacts-to-s3: | ||
| if: ${{ inputs.package == 'polkadot' }} | ||
| needs: [build-polkadot-deb-package] | ||
| uses: ./.github/workflows/release-reusable-s3-upload.yml | ||
| with: | ||
| package: ${{ inputs.package }} | ||
| release_tag: ${{ inputs.release_tag }} | ||
| secrets: | ||
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
| AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} | ||
|
|
||
|
|
||
| upload-polkadot-parachain-artifacts-to-s3: | ||
| if: ${{ inputs.package == 'polkadot-parachain-bin' }} | ||
| needs: [build-rc] | ||
| uses: ./.github/workflows/release-reusable-s3-upload.yml | ||
| with: | ||
| package: ${{ inputs.package }} | ||
| release_tag: ${{ inputs.release_tag }} | ||
| secrets: | ||
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
| AWS_RELEASE_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Upload to s3 | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| package: | ||
| description: Package to be built, for now is either polkadot or polkadot-parachain-bin | ||
| required: true | ||
| type: string | ||
|
|
||
| release_tag: | ||
| description: Tag matching the actual release candidate with the format stableYYMM-rcX or stableYYMM-rcX | ||
| required: true | ||
| type: string | ||
|
|
||
| secrets: | ||
| AWS_DEFAULT_REGION: | ||
| required: true | ||
| AWS_RELEASE_ACCESS_KEY_ID: | ||
| required: true | ||
| AWS_RELEASE_SECRET_ACCESS_KEY: | ||
| required: true | ||
|
|
||
| jobs: | ||
| upload-artifacts-to-s3: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} | ||
| AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
|
|
||
| - name: Download artifacts | ||
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
| with: | ||
| name: ${{ inputs.package }} | ||
| path: artifacts/${{ inputs.package }} | ||
|
|
||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | ||
| with: | ||
| aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Upload ${{ inputs.package }} artifacts to s3 | ||
| run: | | ||
| . ./.github/scripts/release/release_lib.sh | ||
| upload_s3_release ${{ inputs.package }} ${{ inputs.release_tag }} |
Uh oh!
There was an error while loading. Please reload this page.