3333 VERSION : ${{ github.event.inputs.version }}
3434 R_VERSION : ${{ github.event.inputs.r_version }}
3535 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36- RUN_ID : ${{ github.run_id }}
3736 run : |
3837 if [ "$VERSION" == "devel" ]; then
3938 # Read current BIOCONDUCTOR_VERSION and increment the minor version
@@ -61,34 +60,23 @@ jobs:
6160 EOF
6261 else
6362 # Derive release branch name from version (e.g., 3.23 -> RELEASE_3_23)
64- RELEASE_BRANCH="RELEASE_$(echo "$VERSION" | tr '.' '_')"
65- WORK_BRANCH="update-${RELEASE_BRANCH}-${RUN_ID}"
66- BRANCH_NAME="$WORK_BRANCH"
63+ BRANCH_NAME="RELEASE_$(echo "$VERSION" | tr '.' '_')"
6764
68- # Create the release branch from devel with no changes first, then push it.
69- # If it already exists, use the existing remote branch as the base.
65+ # Create the release branch from devel only if it does not already exist.
7066 git checkout devel
71- if git ls-remote --exit-code --heads origin "$RELEASE_BRANCH" >/dev/null; then
72- git fetch origin "$RELEASE_BRANCH"
73- git checkout -B "$RELEASE_BRANCH" "origin/$RELEASE_BRANCH"
74- else
75- git checkout -b "$RELEASE_BRANCH"
76- git push origin "$RELEASE_BRANCH"
67+ if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null; then
68+ echo "Release branch ${BRANCH_NAME} already exists; skipping."
69+ exit 0
7770 fi
78-
79- # Apply release-specific updates in a separate working branch
80- git checkout -b "$WORK_BRANCH"
71+ git checkout -b "$BRANCH_NAME"
8172
8273 # Update amd64_tag and arm64_tag to the specific R version for this release
8374 sed -i "s/^ARG amd64_tag=.*/ARG amd64_tag=${R_VERSION}/" Dockerfile
8475 sed -i "s/^ARG arm64_tag=.*/ARG arm64_tag=${R_VERSION}/" Dockerfile
8576 # Reset BIOCONDUCTOR_PATCH to 0
8677 sed -i "s/^ARG BIOCONDUCTOR_PATCH=.*/ARG BIOCONDUCTOR_PATCH=0/" Dockerfile
8778
88- PR_TITLE="Update ${RELEASE_BRANCH} for Bioconductor ${VERSION}"
89- cat > /tmp/pr_body.md << EOF
90- This PR applies release-specific Dockerfile updates on top of \`${RELEASE_BRANCH}\`, which was created from \`devel\` with no differences.
91- EOF
79+ PR_TITLE="Create ${BRANCH_NAME} for Bioconductor ${VERSION}"
9280 fi
9381
9482 git add Dockerfile
@@ -103,10 +91,5 @@ jobs:
10391 --base "devel" \
10492 || echo "PR already exists for branch ${BRANCH_NAME}, skipping creation."
10593 else
106- gh pr create \
107- --title "$PR_TITLE" \
108- --body-file /tmp/pr_body.md \
109- --head "$WORK_BRANCH" \
110- --base "$RELEASE_BRANCH" \
111- || echo "PR already exists for branch ${WORK_BRANCH}, skipping creation."
94+ echo "Release branch ${BRANCH_NAME} created and pushed; no PR will be opened."
11295 fi
0 commit comments