|
| 1 | +name: Release - Post Crates Release Activities |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'post-crates-release-*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + set-image: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + IMAGE: ${{ steps.set_image.outputs.IMAGE }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - id: set_image |
| 22 | + run: cat .github/env >> $GITHUB_OUTPUT |
| 23 | + |
| 24 | + post-crates-activities: |
| 25 | + needs: set-image |
| 26 | + runs-on: ubuntu-latest |
| 27 | + environment: release |
| 28 | + env: |
| 29 | + PGP_KMS_KEY: ${{ secrets.PGP_KMS_SIGN_COMMITS_KEY }} |
| 30 | + PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }} |
| 31 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 32 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 33 | + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |
| 34 | + container: |
| 35 | + image: ${{ needs.set-image.outputs.IMAGE }} |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Install pgpkms |
| 39 | + run: | |
| 40 | + # Install pgpkms that is used to sign commits |
| 41 | + pip install git+https://github.com/paritytech-release/pgpkms.git@6cb1cecce1268412189b77e4b130f4fa248c4151 |
| 42 | + # Find and display where pgpkms-git is installed |
| 43 | + echo "pgpkms-git location: $(which pgpkms-git)" |
| 44 | + ls -la $(which pgpkms-git) |
| 45 | +
|
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + |
| 51 | + - name: Import GPG keys |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + . ./.github/scripts/common/lib.sh |
| 55 | + import_gpg_keys |
| 56 | +
|
| 57 | + - name: Configure git |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" |
| 61 | + git config --global commit.gpgsign true |
| 62 | + # Dynamically find pgpkms-git path |
| 63 | + PGPKMS_PATH=$(which pgpkms-git) |
| 64 | + echo "Using pgpkms-git at: $PGPKMS_PATH" |
| 65 | + git config --global gpg.program "$PGPKMS_PATH" |
| 66 | + git config --global user.name "ParityReleases" |
| 67 | + git config --global user.email "release-team@parity.io" |
| 68 | + git config --global user.signingKey "D8018FBB3F534D866A45998293C5FB5F6A367B51" |
| 69 | +
|
| 70 | + - name: Bump NODE_VERSION for polkadot |
| 71 | + run: | |
| 72 | + echo "Bumping NODE_VERSION in polkadot..." |
| 73 | + FILE="polkadot/node/primitives/src/lib.rs" |
| 74 | +
|
| 75 | + # Extract current NODE_VERSION |
| 76 | + current_version=$(grep 'pub const NODE_VERSION' "$FILE" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"') |
| 77 | + echo "Current version: $current_version" |
| 78 | +
|
| 79 | + # Bump patch version |
| 80 | + new_version=$(echo "$current_version" | awk -F. '{print $1"."$2"."$3+1}') |
| 81 | + echo "New version: $new_version" |
| 82 | +
|
| 83 | + # Update the file |
| 84 | + sed -i.bak "s/NODE_VERSION: &'static str = \"$current_version\"/NODE_VERSION: \&'static str = \"$new_version\"/" "$FILE" |
| 85 | + rm -f "$FILE.bak" |
| 86 | +
|
| 87 | + echo "Successfully bumped NODE_VERSION from $current_version to $new_version" |
| 88 | +
|
| 89 | + - name: Bump NODE_VERSION for polkadot-parachain and polkadot-omni-node |
| 90 | + run: | |
| 91 | + echo "Bumping NODE_VERSION in cumulus..." |
| 92 | + FILE="cumulus/polkadot-omni-node/lib/src/nodes/mod.rs" |
| 93 | +
|
| 94 | + # Extract current NODE_VERSION |
| 95 | + current_version=$(grep 'pub const NODE_VERSION' "$FILE" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"') |
| 96 | + echo "Current version: $current_version" |
| 97 | +
|
| 98 | + # Bump patch version |
| 99 | + new_version=$(echo "$current_version" | awk -F. '{print $1"."$2"."$3+1}') |
| 100 | + echo "New version: $new_version" |
| 101 | +
|
| 102 | + # Update the file |
| 103 | + sed -i.bak "s/NODE_VERSION: &'static str = \"$current_version\"/NODE_VERSION: \&'static str = \"$new_version\"/" "$FILE" |
| 104 | + rm -f "$FILE.bak" |
| 105 | +
|
| 106 | + echo "Successfully bumped NODE_VERSION from $current_version to $new_version" |
| 107 | +
|
| 108 | + - name: Commit NODE_VERSION bumps |
| 109 | + shell: bash |
| 110 | + run: | |
| 111 | + . ./.github/scripts/release/release_lib.sh |
| 112 | +
|
| 113 | + # Extract the bumped NODE_VERSION |
| 114 | + FILE="polkadot/node/primitives/src/lib.rs" |
| 115 | + NODE_VERSION=$(grep 'pub const NODE_VERSION' "$FILE" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"') |
| 116 | +
|
| 117 | + echo "Committing NODE_VERSION bump to $NODE_VERSION" |
| 118 | + commit_with_message "Bump NODE_VERSION to $NODE_VERSION" |
| 119 | + echo "✅ Successfully committed NODE_VERSION bump" |
| 120 | +
|
| 121 | + - name: Move prdocs to release folder |
| 122 | + shell: bash |
| 123 | + run: | |
| 124 | + . ./.github/scripts/release/release_lib.sh |
| 125 | +
|
| 126 | + # Extract release name from branch name (everything after "post-crates-release-") |
| 127 | + BRANCH_NAME="${{ github.ref_name }}" |
| 128 | + echo "Branch name: $BRANCH_NAME" |
| 129 | +
|
| 130 | + if [[ "$BRANCH_NAME" =~ post-crates-release-(.+)$ ]]; then |
| 131 | + RELEASE_FOLDER="${BASH_REMATCH[1]}" |
| 132 | + echo "Release folder name: $RELEASE_FOLDER" |
| 133 | +
|
| 134 | + # Use the reorder_prdocs helper function |
| 135 | + reorder_prdocs "$RELEASE_FOLDER" |
| 136 | + else |
| 137 | + echo "WARNING: Could not extract release name from branch name: $BRANCH_NAME" |
| 138 | + echo "Expected format: post-crates-release-<release-name>" |
| 139 | + exit 1 |
| 140 | + fi |
| 141 | +
|
| 142 | + - name: Replace path dependencies |
| 143 | + run: | |
| 144 | + echo "Running replace-all-path-deps.sh..." |
| 145 | + bash scripts/release/replace-all-path-deps.sh |
| 146 | + |
| 147 | + # Show git diff to see what changed |
| 148 | + git diff --stat |
| 149 | +
|
| 150 | + - name: Remove versions where path deps are present |
| 151 | + run: | |
| 152 | + echo "Running delete-versions-if-path-is-present.sh..." |
| 153 | + bash scripts/release/delete-versions-if-path-is-present.sh |
| 154 | + |
| 155 | + # Show git diff to see what changed |
| 156 | + git diff --stat |
| 157 | +
|
| 158 | + - name: Remove version from umbrella/Cargo.toml |
| 159 | + run: | |
| 160 | + echo "Running delete-version-from-umbrella.sh..." |
| 161 | + bash scripts/release/delete-version-from-umbrella.sh |
| 162 | + |
| 163 | + # Show git diff to see what changed |
| 164 | + git diff --stat |
| 165 | +
|
| 166 | + - name: Run Zepter - check issues |
| 167 | + run: | |
| 168 | + echo "Running zepter run check to identify issues..." |
| 169 | + zepter run check || echo "Zepter found issues that need to be fixed" |
| 170 | +
|
| 171 | + - name: Run Zepter - fix issues |
| 172 | + run: | |
| 173 | + echo "Running zepter to fix issues..." |
| 174 | + zepter || echo "Zepter fix completed" |
| 175 | + # Show git diff to see what changed |
| 176 | + git diff --stat |
| 177 | +
|
| 178 | + - name: Run Zepter - verify fixes |
| 179 | + run: | |
| 180 | + echo "Running zepter run check again to verify fixes..." |
| 181 | + zepter run check || echo "There are still issues to fix manually" |
| 182 | +
|
| 183 | + - name: Run taplo - check formatting |
| 184 | + run: | |
| 185 | + echo "Running taplo format check..." |
| 186 | + taplo format --check --config .config/taplo.toml || echo "Taplo found formatting issues" |
| 187 | +
|
| 188 | + - name: Run taplo - format |
| 189 | + run: | |
| 190 | + echo "Running taplo format..." |
| 191 | + taplo format --config .config/taplo.toml |
| 192 | + # Show git diff to see what changed |
| 193 | + git diff --stat |
| 194 | +
|
| 195 | + - name: Run taplo - verify formatting |
| 196 | + run: | |
| 197 | + echo "Running taplo format check again..." |
| 198 | + taplo format --check --config .config/taplo.toml || echo "There are still formatting issues" |
| 199 | +
|
| 200 | + - name: Install Python dependencies |
| 201 | + run: | |
| 202 | + echo "Installing Python dependencies..." |
| 203 | + pip3 install toml "cargo-workspace>=1.2.6" |
| 204 | +
|
| 205 | + - name: Run workspace check |
| 206 | + run: | |
| 207 | + echo "Running workspace check..." |
| 208 | + python3 .github/scripts/check-workspace.py . --exclude \ |
| 209 | + "substrate/frame/contracts/fixtures/build" \ |
| 210 | + "substrate/frame/contracts/fixtures/contracts/common" |
| 211 | +
|
| 212 | + - name: Deny git dependencies |
| 213 | + run: | |
| 214 | + echo "Checking for git dependencies..." |
| 215 | + python3 .github/scripts/deny-git-deps.py . |
| 216 | +
|
| 217 | + - name: Check git status before commit |
| 218 | + run: | |
| 219 | + echo "=== Git status ===" |
| 220 | + git status |
| 221 | + echo "" |
| 222 | + echo "=== Git status --porcelain ===" |
| 223 | + git status --porcelain |
| 224 | + echo "" |
| 225 | + echo "=== Changed files count ===" |
| 226 | + git status --porcelain | wc -l |
| 227 | +
|
| 228 | + - name: Commit and push changes |
| 229 | + shell: bash |
| 230 | + run: | |
| 231 | + . ./.github/scripts/release/release_lib.sh |
| 232 | +
|
| 233 | + # Check if there are changes to commit |
| 234 | + if [[ -n $(git status --porcelain) ]]; then |
| 235 | + commit_with_message "chore: post crates release actions - version bumps, path deps, zepter, taplo" |
| 236 | + echo "Changes committed successfully" |
| 237 | + # Push changes to the branch |
| 238 | + echo "Pushing changes to branch..." |
| 239 | + git push |
| 240 | + echo "Changes pushed successfully" |
| 241 | + else |
| 242 | + echo "No changes to commit" |
| 243 | + fi |
| 244 | +
|
| 245 | + - name: Create Pull Request to base release branch |
| 246 | + env: |
| 247 | + GH_TOKEN: ${{ github.token }} |
| 248 | + shell: bash |
| 249 | + run: | |
| 250 | + BRANCH_NAME="${{ github.ref_name }}" |
| 251 | + echo "Current branch: $BRANCH_NAME" |
| 252 | +
|
| 253 | + # Extract base release branch name |
| 254 | + if [[ "$BRANCH_NAME" =~ ^post-crates-release-(.+)$ ]]; then |
| 255 | + FULL_RELEASE="${BASH_REMATCH[1]}" |
| 256 | +
|
| 257 | + if [[ "$FULL_RELEASE" =~ ^(.+)-[^-]+$ ]]; then |
| 258 | + BASE_RELEASE="${BASH_REMATCH[1]}" |
| 259 | + else |
| 260 | + BASE_RELEASE="$FULL_RELEASE" |
| 261 | + fi |
| 262 | +
|
| 263 | + echo "Creating PR from $BRANCH_NAME to $BASE_RELEASE..." |
| 264 | + gh pr create \ |
| 265 | + --title "Post crates release activities for $BASE_RELEASE" \ |
| 266 | + --body "Automated PR containing post-crates-release activities: |
| 267 | + - NODE_VERSION bumps |
| 268 | + - Path dependencies replacement |
| 269 | + - Zepter fixes |
| 270 | + - Taplo formatting |
| 271 | + - PRDocs reorganization" \ |
| 272 | + --base "$BASE_RELEASE" \ |
| 273 | + --head "$BRANCH_NAME" || echo "PR may already exist or there was an error creating it" |
| 274 | + else |
| 275 | + echo "ERROR: Could not extract base release branch from: $BRANCH_NAME, probably wrong format" |
| 276 | + exit 1 |
| 277 | + fi |
| 278 | +
|
| 279 | + - name: Add comment about spec_version |
| 280 | + env: |
| 281 | + GH_TOKEN: ${{ github.token }} |
| 282 | + shell: bash |
| 283 | + run: | |
| 284 | + BRANCH_NAME="${{ github.ref_name }}" |
| 285 | +
|
| 286 | + # Find the PR number for this branch |
| 287 | + PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number') |
| 288 | +
|
| 289 | + if [ -n "$PR_NUMBER" ]; then |
| 290 | + echo "Adding comment to PR #$PR_NUMBER..." |
| 291 | + gh pr comment "$PR_NUMBER" --body "⚠️ **Reminder:** spec_version is not bumped automatically as part of this flow. Please ensure it is updated manually if required." |
| 292 | + else |
| 293 | + echo "WARNING: Could not find PR for branch $BRANCH_NAME" |
| 294 | + fi |
0 commit comments