|
| 1 | +name: Release - Publish polakdot deb package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: Current final release tag in the format polakdot-stableYYMM or polkadot-stable-YYMM-X |
| 8 | + default: polkadot-stable2412 |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + |
| 12 | + distribution: |
| 13 | + description: Distribution where to publish deb package (release, staging, stable2407, etc) |
| 14 | + default: staging |
| 15 | + required: true |
| 16 | + type: string |
| 17 | + |
| 18 | +jobs: |
| 19 | + check-synchronization: |
| 20 | + uses: paritytech-release/sync-workflows/.github/workflows/check-syncronization.yml@main |
| 21 | + |
| 22 | + validate-inputs: |
| 23 | + needs: [check-synchronization] |
| 24 | + if: ${{ needs.check-synchronization.outputs.checks_passed }} == 'true' |
| 25 | + runs-on: ubuntu-latest |
| 26 | + outputs: |
| 27 | + release_tag: ${{ steps.validate_inputs.outputs.release_tag }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout sources |
| 31 | + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 32 | + |
| 33 | + - name: Validate inputs |
| 34 | + id: validate_inputs |
| 35 | + run: | |
| 36 | + . ./.github/scripts/common/lib.sh |
| 37 | +
|
| 38 | + RELEASE_TAG=$(validate_stable_tag ${{ inputs.tag }}) |
| 39 | + echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT |
| 40 | +
|
| 41 | +
|
| 42 | + fetch-artifacts-from-s3: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: [validate-inputs] |
| 45 | + env: |
| 46 | + REPO: ${{ github.repository }} |
| 47 | + RELEASE_TAG: ${{ needs.validate-inputs.outputs.release_tag }} |
| 48 | + outputs: |
| 49 | + VERSION: ${{ steps.fetch_artifacts_from_s3.outputs.VERSION }} |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout sources |
| 53 | + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 54 | + |
| 55 | + - name: Fetch rc artifacts or release artifacts from s3 based on version |
| 56 | + id: fetch_artifacts_from_s3 |
| 57 | + run: | |
| 58 | + . ./.github/scripts/common/lib.sh |
| 59 | +
|
| 60 | + VERSION="$(get_polkadot_node_version_from_code)" |
| 61 | + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT |
| 62 | +
|
| 63 | + fetch_debian_package_from_s3 polkadot |
| 64 | +
|
| 65 | + - name: Upload artifacts |
| 66 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 67 | + with: |
| 68 | + name: release-artifacts |
| 69 | + path: release-artifacts/polkadot/*.deb |
| 70 | + |
| 71 | + publish-deb-package: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: [fetch-artifacts-from-s3] |
| 74 | + environment: release |
| 75 | + env: |
| 76 | + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |
| 77 | + AWS_DEB_PATH: "s3://releases-package-repos/deb" |
| 78 | + LOCAL_DEB_REPO_PATH: ${{ github.workspace }}/deb |
| 79 | + VERSION: ${{ needs.fetch-artifacts-from-s3.outputs.VERSION }} |
| 80 | + |
| 81 | + steps: |
| 82 | + - name: Install pgpkkms |
| 83 | + run: | |
| 84 | + # Install pgpkms that is used to sign built artifacts |
| 85 | + python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@1f8555426662ac93a3849480a35449f683b1c89f" |
| 86 | + echo "PGPKMS_REPREPRO_PATH=$(which pgpkms-reprepro)" >> $GITHUB_ENV |
| 87 | +
|
| 88 | + - name: Install awscli |
| 89 | + run: | |
| 90 | + python3 -m pip install awscli |
| 91 | + which aws |
| 92 | +
|
| 93 | + - name: Checkout sources |
| 94 | + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 |
| 95 | + |
| 96 | + - name: Import gpg keys |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + . ./.github/scripts/common/lib.sh |
| 100 | +
|
| 101 | + import_gpg_keys |
| 102 | +
|
| 103 | + - name: Download artifacts |
| 104 | + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 |
| 105 | + with: |
| 106 | + name: release-artifacts |
| 107 | + path: release-artifacts |
| 108 | + |
| 109 | + - name: Setup local deb repo |
| 110 | + run: | |
| 111 | + sudo apt-get install -y reprepro |
| 112 | + which reprepro |
| 113 | +
|
| 114 | + sed -i "s|^SignWith:.*|SignWith: ! ${PGPKMS_REPREPRO_PATH}|" ${{ github.workspace }}/.github/scripts/release/distributions |
| 115 | +
|
| 116 | + mkdir -p ${{ github.workspace }}/deb/conf |
| 117 | + cp ${{ github.workspace }}/.github/scripts/release/distributions ${{ github.workspace }}/deb/conf/distributions |
| 118 | + cat ${{ github.workspace }}/deb/conf/distributions |
| 119 | +
|
| 120 | + - name: Sync local deb repo |
| 121 | + env: |
| 122 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} |
| 123 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} |
| 124 | + run: | |
| 125 | + # Download the current state of the deb repo |
| 126 | + aws s3 sync "$AWS_DEB_PATH/db" "$LOCAL_DEB_REPO_PATH/db" |
| 127 | + aws s3 sync "$AWS_DEB_PATH/pool" "$LOCAL_DEB_REPO_PATH/pool" |
| 128 | + aws s3 sync "$AWS_DEB_PATH/dists" "$LOCAL_DEB_REPO_PATH/dists" |
| 129 | +
|
| 130 | + - name: Add deb package to local repo |
| 131 | + env: |
| 132 | + PGP_KMS_KEY: ${{ secrets.PGP_KMS_KEY }} |
| 133 | + PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }} |
| 134 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 135 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 136 | + run: | |
| 137 | + # Add the new deb to the repo |
| 138 | + reprepro -b "$LOCAL_DEB_REPO_PATH" includedeb "${{ inputs.distribution }}" "release-artifacts/polkadot_${VERSION}_amd64.deb" |
| 139 | +
|
| 140 | + - name: Upload updated deb repo |
| 141 | + env: |
| 142 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_RELEASE_ACCESS_KEY_ID }} |
| 143 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_RELEASE_SECRET_ACCESS_KEY }} |
| 144 | + run: | |
| 145 | + # Upload the updated repo - dists and pool should be publicly readable |
| 146 | + aws s3 sync "$LOCAL_DEB_REPO_PATH/pool" "$AWS_DEB_PATH/pool" --acl public-read |
| 147 | + aws s3 sync "$LOCAL_DEB_REPO_PATH/dists" "$AWS_DEB_PATH/dists" --acl public-read |
| 148 | + aws s3 sync "$LOCAL_DEB_REPO_PATH/db" "$AWS_DEB_PATH/db" |
| 149 | + aws s3 sync "$LOCAL_DEB_REPO_PATH/conf" "$AWS_DEB_PATH/conf" |
| 150 | +
|
| 151 | + # Invalidate caches to make sure latest files are served |
| 152 | + aws cloudfront create-invalidation --distribution-id E36FKEYWDXAZYJ --paths '/deb/*' |
0 commit comments