diff --git a/.github/workflows/release-60_post-crates-release-activities.yml b/.github/workflows/release-60_post-crates-release-activities.yml index 010a2b07940b4..4f4eb350d5f68 100644 --- a/.github/workflows/release-60_post-crates-release-activities.yml +++ b/.github/workflows/release-60_post-crates-release-activities.yml @@ -27,7 +27,14 @@ permissions: pull-requests: write jobs: + #check-synchronization: + # uses: paritytech-release/sync-workflows/.github/workflows/check-synchronization.yml@main + #secrets: + # fork_writer_app_key: ${{ secrets.UPSTREAM_CONTENT_SYNC_APP_KEY }} + set-image: + #needs: [ check-synchronization ] + #if: needs.check-synchronization.outputs.checks_passed == 'true' runs-on: ubuntu-latest outputs: IMAGE: ${{ steps.set_image.outputs.IMAGE }} @@ -283,9 +290,18 @@ jobs: echo "No changes to commit" fi + - name: Generate token for paritytech/polkadot-sdk + id: generate_write_token + uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 + with: + app-id: ${{ vars.POLKADOT_SDK_RELEASE_RW_APP_ID }} + private-key: ${{ secrets.POLKADOT_SDK_RELEASE_RW_APP_KEY }} + owner: paritytech + repositories: polkadot-sdk + - name: Create Pull Request to base release branch env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ steps.generate_write_token.outputs.token }} shell: bash run: | BRANCH_NAME="${{ github.ref_name }}" @@ -300,15 +316,30 @@ jobs: BASE_RELEASE="$FULL_RELEASE" fi + TARGET_REPO="paritytech/polkadot-sdk" + + # Determine if running from a fork or the main repo + if [ "${{ github.repository }}" = "$TARGET_REPO" ]; then + # Same-repo PR: head is just the branch name + PR_HEAD="$BRANCH_NAME" + EXTRA_FLAGS="" + else + # Cross-fork PR: head needs the fork owner prefix + FORK_OWNER="${{ github.repository_owner }}" + PR_HEAD="${FORK_OWNER}:${BRANCH_NAME}" + EXTRA_FLAGS="--no-maintainer-edit" + fi + # Check if PR already exists - EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_RELEASE" --json number --jq '.[0].number') + EXISTING_PR=$(gh pr list --repo "$TARGET_REPO" --head "$PR_HEAD" --base "$BASE_RELEASE" --json number --jq '.[0].number') if [ -n "$EXISTING_PR" ]; then echo "✅ PR #$EXISTING_PR already exists for this branch" - echo "PR URL: $(gh pr view $EXISTING_PR --json url --jq '.url')" + echo "PR URL: $(gh pr view $EXISTING_PR --repo "$TARGET_REPO" --json url --jq '.url')" else - echo "Creating PR from $BRANCH_NAME to $BASE_RELEASE..." + echo "Creating PR from $PR_HEAD to $BASE_RELEASE in $TARGET_REPO..." gh pr create \ + --repo "$TARGET_REPO" \ --title "[${BASE_RELEASE}] Post crates release activities for $FULL_RELEASE" \ --body "Automated PR containing post-crates-release activities: - NODE_VERSION bumps (if selected) @@ -317,23 +348,33 @@ jobs: - Taplo formatting - PRDocs reorganization (if prdocs exist)" \ --base "$BASE_RELEASE" \ - --head "$BRANCH_NAME" - echo "✅ PR created successfully" + --head "$PR_HEAD" \ + $EXTRA_FLAGS + echo "PR created successfully" fi - name: Add comment about spec_version env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ steps.generate_write_token.outputs.token }} shell: bash run: | BRANCH_NAME="${{ github.ref_name }}" + TARGET_REPO="paritytech/polkadot-sdk" + + # Match the head format used when creating the PR + if [ "${{ github.repository }}" = "$TARGET_REPO" ]; then + PR_HEAD="$BRANCH_NAME" + else + FORK_OWNER="${{ github.repository_owner }}" + PR_HEAD="${FORK_OWNER}:${BRANCH_NAME}" + fi - # Find the PR number for this branch - PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number') + # Find the PR number for this branch in the upstream repo + PR_NUMBER=$(gh pr list --repo "$TARGET_REPO" --head "$PR_HEAD" --json number --jq '.[0].number') if [ -n "$PR_NUMBER" ]; then echo "Adding comment to PR #$PR_NUMBER..." - 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." + gh pr comment "$PR_NUMBER" --repo "$TARGET_REPO" --body "⚠️ **Reminder:** If spec_version was not bumped automatically as part of this flow. Please ensure it is updated manually if required." else - echo "WARNING: Could not find PR for branch $BRANCH_NAME" + echo "⚠️ WARNING: Could not find PR for branch $PR_HEAD" fi diff --git a/.github/workflows/release-80_publish-crates.yml b/.github/workflows/release-80_publish-crates.yml index 85dd6d7332bd7..de9183adb7f24 100644 --- a/.github/workflows/release-80_publish-crates.yml +++ b/.github/workflows/release-80_publish-crates.yml @@ -30,7 +30,14 @@ permissions: contents: write jobs: + check-synchronization: + uses: paritytech-release/sync-workflows/.github/workflows/check-synchronization.yml@main + secrets: + fork_writer_app_key: ${{ secrets.UPSTREAM_CONTENT_SYNC_APP_KEY }} + set-image: + needs: [ check-synchronization ] + if: needs.check-synchronization.outputs.checks_passed == 'true' runs-on: ubuntu-latest outputs: IMAGE: ${{ steps.set_image.outputs.IMAGE }} @@ -62,6 +69,7 @@ jobs: - name: Derive stable branch from release name id: derive_branch + shell: bash run: | RELEASE_NAME="${{ inputs.release_name }}" echo "Release name: $RELEASE_NAME" @@ -105,6 +113,7 @@ jobs: git config --global user.signingKey "D8018FBB3F534D866A45998293C5FB5F6A367B51" - name: Create or switch to release branch + shell: bash run: | CRATES_RELEASE_BRANCH="${{ steps.derive_branch.outputs.CRATES_RELEASE_BRANCH }}" @@ -118,6 +127,7 @@ jobs: echo "On branch $CRATES_RELEASE_BRANCH" - name: Install Rust 1.93 + shell: bash run: | rustup install 1.93 rustup default 1.93 @@ -131,7 +141,9 @@ jobs: cache-on-failure: true - name: Install parity-publish - run: cargo install parity-publish@0.10.6 --locked -q + run: | + apt-get update && apt-get install -y --no-install-recommends libcurl4-openssl-dev pkg-config + cargo install parity-publish@0.10.10 --locked -q - name: Run parity-publish plan run: | @@ -152,6 +164,7 @@ jobs: - name: Parse crate names for release notes if: inputs.is_patch + shell: bash run: | RELEASE_NAME="${{ inputs.release_name }}" @@ -213,6 +226,7 @@ jobs: echo "Successfully pushed $CRATES_RELEASE_BRANCH" - name: Configure cargo registry + shell: bash run: | REGISTRY="${{ inputs.registry }}" echo "Configuring cargo for $REGISTRY..." @@ -231,6 +245,7 @@ jobs: cat ~/.cargo/config.toml || echo "(using defaults)" - name: Publish crates + shell: bash env: PARITY_PUBLISH_CRATESIO_TOKEN: ${{ inputs.registry == 'staging.crates.io' && secrets.STAGING_CRATES_IO_API_TOKEN || secrets.CRATES_IO_API_TOKEN }} run: | diff --git a/scripts/release/replace-all-path-deps.sh b/scripts/release/replace-all-path-deps.sh index 21be034cfa9a5..36cc7e64bb142 100755 --- a/scripts/release/replace-all-path-deps.sh +++ b/scripts/release/replace-all-path-deps.sh @@ -14,8 +14,7 @@ find . -name "Cargo.toml" \ # Find and replace path dependencies with "workspace = true" awk ' BEGIN { in_section = 0 } - /^\[dependencies\]/ { in_section = 1; print; next } - /^\[dev-dependencies\]/ { in_section = 2; print; next } + /^\[.*dependencies\]/ { in_section = 1; print; next } /^\[.*\]/ { in_section = 0; print; next } {