From bdedea90e23f2d4d8f903592450825f8aa74dfcc Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Fri, 1 Nov 2024 22:25:47 +0000 Subject: [PATCH 1/8] Update github bot in release automation scripts * Also remove restriction that action can only be run on main. --- .github/workflows/release-finalize.yml | 4 ++-- .github/workflows/update-branch-version.yml | 16 +++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-finalize.yml b/.github/workflows/release-finalize.yml index 67e2aad6015..a68c3587c4d 100644 --- a/.github/workflows/release-finalize.yml +++ b/.github/workflows/release-finalize.yml @@ -142,8 +142,8 @@ jobs: - name: Tag run: | - git config user.name github-actions - git config user.email github-actions@github.com + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git tag -a -m "CCCL Release ${release_tag}" ${release_tag} ${rc_tag} git push origin ${release_tag} diff --git a/.github/workflows/update-branch-version.yml b/.github/workflows/update-branch-version.yml index 08f5d7359f5..25db0206f3b 100644 --- a/.github/workflows/update-branch-version.yml +++ b/.github/workflows/update-branch-version.yml @@ -16,8 +16,7 @@ name: "Release: 0. Update version in target branch" # The target branch when starting this workflow should be: -# 1. "branch/{major}.{minor}.x" if it exists, or -# 2. "main" +# "branch/{major}.{minor}.x" if it exists, or "main" on: workflow_dispatch: @@ -56,15 +55,6 @@ jobs: with: ref: ${{ inputs.target_branch }} - - name: Verify run from main - id: verify-main - run: | - # This action can only be run from main. - if [[ $GITHUB_REF != refs/heads/main ]]; then - echo " This action may only be run fom main" | tee -a $GITHUB_STEP_SUMMARY - exit 1 - fi - - name: Prepare environment id: prepare-env run: | @@ -145,8 +135,8 @@ jobs: git add . - git config user.name github-actions - git config user.email github-actions@github.com + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git commit -m "${pr_body}" # Push the changes to the release branch: From df00274f56797caeb6830277aa43041204e83c6c Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Fri, 1 Nov 2024 22:26:08 +0000 Subject: [PATCH 2/8] Add workflow for creating new release branches --- .github/workflows/release-create-new.yml | 145 +++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 .github/workflows/release-create-new.yml diff --git a/.github/workflows/release-create-new.yml b/.github/workflows/release-create-new.yml new file mode 100644 index 00000000000..659d725e486 --- /dev/null +++ b/.github/workflows/release-create-new.yml @@ -0,0 +1,145 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Release: 1. Begin Release Cycle" + +# The branch or tag selected when starting the workflow should be: +# 1. "branch/{major}.{minor}.x" if it exists, or +# 2. The ref to use when branching the release branch. + +on: + workflow_dispatch: + inputs: + main_version: + description: "Next version of main. (x.y.z)" + type: string + required: true + +defaults: + run: + shell: bash --noprofile --norc -euo pipefail {0} + +jobs: + create-release-branch: + env: + GH_TOKEN: ${{ github.token }} + permissions: + actions: write + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Prepare environment + id: prepare-env + run: | + log_and_export_vars() { + for var in "$@"; do + printf "%-15s %s\n" "$var:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY + echo "${var}=${!var}" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT + done + } + + repo_version=$(jq -r .full cccl-version.json) + main_version=${{ inputs.main_version }} + + if [[ ! $repo_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version number: $repo_version" + exit 1 + fi + + if [[ ! $main_version =~ ^[0-9]+\.[0-9]+\.[0-9]*$ ]]; then + echo "Invalid main version number: $main_version" + exit 1 + fi + + major_version=$(echo ${repo_version} | cut -d. -f1) + minor_version=$(echo ${repo_version} | cut -d. -f2) + patch_version=$(echo ${repo_version} | cut -d. -f3) + branch_name="branch/${major_version}.${minor_version}.x" + + main_major_version=$(echo ${main_version} | cut -d. -f1) + main_minor_version=$(echo ${main_version} | cut -d. -f2) + main_patch_version=$(echo ${main_version} | cut -d. -f3) + + log_and_export_vars \ + repo_version major_version minor_version patch_version \ + main_version main_major_version main_minor_version main_patch_version \ + branch_name + + echo "Branch ref: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch SHA: $GITHUB_SHA" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch commit: $(git show --oneline --no-patch ${GITHUB_SHA})" | tee -a $GITHUB_STEP_SUMMARY + + - name: Verify environment + run: | + # If the release branch already exists, it must match the branch point: + if git ls-remote --exit-code origin $branch_name; then + echo "Branch $branch_name already exists" | tee -a $GITHUB_STEP_SUMMARY + echo " GITHUB_REF: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY + echo " branch_name: $branch_name" | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + + - name: Create release branch + id: create_branch + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + git push origin ${GITHUB_SHA}:"refs/heads/$branch_name" + echo "Created branch $branch_name at:" | tee -a $GITHUB_STEP_SUMMARY + + git show --oneline --no-patch HEAD | tee -a $GITHUB_STEP_SUMMARY + + - name: Update version numbers in main + id: update_main + run: | + gh workflow run update-branch-version.yml --ref main -f new_version="$main_version" -f target_branch="main" | tee -a $GITHUB_STEP_SUMMARY + + - name: Notify Slack + if: ${{ success()}} + uses: slackapi/slack-github-action@v1.26.0 + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_BOT_TOKEN }} + SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + BRANCH_NAME: ${{ steps.prepare-env.outputs.branch_name }} + BRANCH_VERSION: ${{ inputs.branch_version }} + MAIN_VERSION: ${{ inputs.main_version }} + MAIN_PR_URL: ${{ steps.create_pr.outputs.pull-request-url }} + with: + channel-id: ${{ secrets.SLACK_CHANNEL_RELEASE_LOG }} + slack-message: | + A new release cycle has started for `v${{ env.BRANCH_VERSION }}` on `${{ env.BRANCH_NAME }}`. + + If requested, a PR to update `main` to `v${{ env.MAIN_VERSION }}` has been created: ${{ env.MAIN_PR_URL }}. + + Workflow summary: ${{ env.SUMMARY_URL }} + + - name: Notify Slack (failure) + if: ${{ failure() }} + uses: slackapi/slack-github-action@v1.26.0 + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFIER_BOT_TOKEN }} + SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + BRANCH_VERSION: ${{ inputs.branch_version }} + with: + channel-id: ${{ secrets.SLACK_CHANNEL_RELEASE_LOG }} + slack-message: | + An error has occurred while initiating a new release cycle for `v${{ env.BRANCH_VERSION }}`. + + Details: ${{ env.SUMMARY_URL }} \ No newline at end of file From d922be3e515e1432d879b05e591ec54a1098a0a5 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 19 Nov 2024 00:55:01 +0000 Subject: [PATCH 3/8] Make version bumps an action --- .github/actions/version-update/action.yml | 127 ++++++++++++++++++++ .github/workflows/release-create-new.yml | 9 +- .github/workflows/update-branch-version.yml | 102 +--------------- 3 files changed, 138 insertions(+), 100 deletions(-) create mode 100644 .github/actions/version-update/action.yml diff --git a/.github/actions/version-update/action.yml b/.github/actions/version-update/action.yml new file mode 100644 index 00000000000..1b182a33515 --- /dev/null +++ b/.github/actions/version-update/action.yml @@ -0,0 +1,127 @@ +name: "Branch Version Update" +description: "Creates a PR to update the version of a specific branch." + +# The target branch when starting this workflow should be: +# "branch/{major}.{minor}.x" if it exists, or "main" + +inputs: + new_version: + description: "Version 'X.Y.Z' for the release branch." + type: string + required: true + default: "0.0.0" + target_branch: + description: "Target branch for the version update" + type: string + required: false + default: "main" + force: + description: "Enable overwriting existing PR branches (this does not force overwrite the target branch or skip creating a PR)" + type: boolean + required: true + default: false + +runs: + using: "composite" + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.target_branch }} + + - name: Prepare environment + id: prepare-env + run: | + log_and_export_vars() { + for var in "$@"; do + printf "%-15s %s\n" "$var:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY + echo "${var}=${!var}" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT + done + } + + full_version=${{ inputs.new_version }} + major_version=$(echo ${full_version} | cut -d. -f1) + minor_version=$(echo ${full_version} | cut -d. -f2) + patch_version=$(echo ${full_version} | cut -d. -f3) + branch_name=${{ inputs.target_branch }} + enable_force_push="${{ inputs.force }}" + pr_title="[Version] Update ${branch_name} to v${full_version}" + pr_body="Bump ${branch_name} to ${full_version}." + pr_branch="pr/ver/${branch_name}-v${full_version}" + + log_and_export_vars \ + full_version major_version minor_version patch_version \ + branch_name pr_title pr_branch pr_body enable_force_push + + echo "Branch ref: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch SHA: $GITHUB_SHA" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch commit: $(git show --oneline --no-patch ${GITHUB_SHA})" | tee -a $GITHUB_STEP_SUMMARY + + - name: Verify environment + id: verify-env + run: | + # Target branch must already exist + if ! git ls-remote --exit-code origin ${branch_name}; then + echo " Target branch must already exist" | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + + #Ensure that target branch version is compatible. + if [[ "${branch_name}" =~ ^branch/[0-9]+\.[0-9]+\.x$ ]]; then + branch_version=$(echo ${branch_name} | cut -d/ -f1 --complement) + branch_major=$(echo ${branch_version} | cut -d. -f1) + branch_minor=$(echo ${branch_version} | cut -d. -f2) + if [ "${branch_major}" != "${major_version}" ]; then + echo " Target branch major version mismatch" + exit 1 + fi; + if [ "${branch_minor}" != "${minor_version}" ]; then + echo " Target branch minor version mismatch" + exit 1 + fi + fi + + # PR branch must *not* exist + if [ "${enable_force_push}" == "false" ]; then + if git ls-remote --exit-code origin ${pr_branch}; then + echo " PR branch cannot already exist - Delete branch and retry workflow or enable 'force'" | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + fi + + if [[ ! $full_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version number: $full_version" + exit 1 + fi + + - name: Update version numbers in target branch + id: create-pr-branch + run: | + git checkout -b ${pr_branch} + echo "::group::Running update_version.sh" + ./ci/update_version.sh ${major_version} ${minor_version} ${patch_version} + echo "::endgroup::" + + if ! git diff --quiet; then + echo "::group::Diff" + git diff + echo "::endgroup::" + + git add . + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "${pr_body}" + + # Push the changes to the release branch: + git push --force origin ${pr_branch} + fi + + - name: Create pull request for target branch + id: create-pr + run: | + gh pr create \ + -B "${branch_name}" \ + -b "${pr_body}" \ + -t "${pr_title}" \ + -H "${pr_branch}" diff --git a/.github/workflows/release-create-new.yml b/.github/workflows/release-create-new.yml index 659d725e486..638325fa035 100644 --- a/.github/workflows/release-create-new.yml +++ b/.github/workflows/release-create-new.yml @@ -107,9 +107,10 @@ jobs: git show --oneline --no-patch HEAD | tee -a $GITHUB_STEP_SUMMARY - name: Update version numbers in main - id: update_main - run: | - gh workflow run update-branch-version.yml --ref main -f new_version="$main_version" -f target_branch="main" | tee -a $GITHUB_STEP_SUMMARY + uses: ${{ github.repository }}/.github/actions/version-update@main + with: + new_version: ${{ inputs.main_version }} + target_branch: "main" - name: Notify Slack if: ${{ success()}} @@ -142,4 +143,4 @@ jobs: slack-message: | An error has occurred while initiating a new release cycle for `v${{ env.BRANCH_VERSION }}`. - Details: ${{ env.SUMMARY_URL }} \ No newline at end of file + Details: ${{ env.SUMMARY_URL }} diff --git a/.github/workflows/update-branch-version.yml b/.github/workflows/update-branch-version.yml index 25db0206f3b..9d15c7dbfee 100644 --- a/.github/workflows/update-branch-version.yml +++ b/.github/workflows/update-branch-version.yml @@ -55,99 +55,9 @@ jobs: with: ref: ${{ inputs.target_branch }} - - name: Prepare environment - id: prepare-env - run: | - log_and_export_vars() { - for var in "$@"; do - printf "%-15s %s\n" "$var:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY - echo "${var}=${!var}" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT - done - } - - full_version=${{ inputs.new_version }} - major_version=$(echo ${full_version} | cut -d. -f1) - minor_version=$(echo ${full_version} | cut -d. -f2) - patch_version=$(echo ${full_version} | cut -d. -f3) - branch_name=${{ inputs.target_branch }} - enable_force_push="${{ inputs.force }}" - pr_title="[Version] Update ${branch_name} to v${full_version}" - pr_body="Bump ${branch_name} to ${full_version}." - pr_branch="pr/ver/${branch_name}-v${full_version}" - - log_and_export_vars \ - full_version major_version minor_version patch_version \ - branch_name pr_title pr_branch pr_body enable_force_push - - echo "Branch ref: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY - echo "Branch SHA: $GITHUB_SHA" | tee -a $GITHUB_STEP_SUMMARY - echo "Branch commit: $(git show --oneline --no-patch ${GITHUB_SHA})" | tee -a $GITHUB_STEP_SUMMARY - - - name: Verify environment - id: verify-env - run: | - # Target branch must already exist - if ! git ls-remote --exit-code origin ${branch_name}; then - echo " Target branch must already exist" | tee -a $GITHUB_STEP_SUMMARY - exit 1 - fi - - #Ensure that target branch version is compatible. - if [[ "${branch_name}" =~ ^branch/[0-9]+\.[0-9]+\.x$ ]]; then - branch_version=$(echo ${branch_name} | cut -d/ -f1 --complement) - branch_major=$(echo ${branch_version} | cut -d. -f1) - branch_minor=$(echo ${branch_version} | cut -d. -f2) - if [ "${branch_major}" != "${major_version}" ]; then - echo " Target branch major version mismatch" - exit 1 - fi; - if [ "${branch_minor}" != "${minor_version}" ]; then - echo " Target branch minor version mismatch" - exit 1 - fi - fi - - # PR branch must *not* exist - if [ "${enable_force_push}" == "false" ]; then - if git ls-remote --exit-code origin ${pr_branch}; then - echo " PR branch cannot already exist - Delete branch and retry workflow or enable 'force'" | tee -a $GITHUB_STEP_SUMMARY - exit 1 - fi - fi - - if [[ ! $full_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Invalid version number: $full_version" - exit 1 - fi - - - name: Update version numbers in target branch - id: create-pr-branch - run: | - git checkout -b ${pr_branch} - echo "::group::Running update_version.sh" - ./ci/update_version.sh ${major_version} ${minor_version} ${patch_version} - echo "::endgroup::" - - if ! git diff --quiet; then - echo "::group::Diff" - git diff - echo "::endgroup::" - - git add . - - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "${pr_body}" - - # Push the changes to the release branch: - git push --force origin ${pr_branch} - fi - - - name: Create pull request for target branch - id: create-pr - run: | - gh pr create \ - -B "${branch_name}" \ - -b "${pr_body}" \ - -t "${pr_title}" \ - -H "${pr_branch}" + - name: Update version + uses: ${{ github.repository }}/.github/actions/version-update@main + with: + new_version: ${{ inputs.new_version }} + target_branch: ${{ inputs.target_branch }} + force: ${{ inputs.force }} From 75bf442f9df694df79d353f29025a5369797f958 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 19 Nov 2024 01:05:10 +0000 Subject: [PATCH 4/8] Fixup URL in version update steps --- .github/workflows/release-create-new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-create-new.yml b/.github/workflows/release-create-new.yml index 638325fa035..59f84ed2215 100644 --- a/.github/workflows/release-create-new.yml +++ b/.github/workflows/release-create-new.yml @@ -107,7 +107,7 @@ jobs: git show --oneline --no-patch HEAD | tee -a $GITHUB_STEP_SUMMARY - name: Update version numbers in main - uses: ${{ github.repository }}/.github/actions/version-update@main + uses: nvidia/cccl/.github/actions/version-update@main with: new_version: ${{ inputs.main_version }} target_branch: "main" From 074cfb53ec650e6e7acccd2b183171b95f87bac7 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 19 Nov 2024 01:09:16 +0000 Subject: [PATCH 5/8] use local version of action instead of main --- .github/workflows/release-create-new.yml | 2 +- .github/workflows/update-branch-version.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-create-new.yml b/.github/workflows/release-create-new.yml index 59f84ed2215..c79e04ea6d7 100644 --- a/.github/workflows/release-create-new.yml +++ b/.github/workflows/release-create-new.yml @@ -107,7 +107,7 @@ jobs: git show --oneline --no-patch HEAD | tee -a $GITHUB_STEP_SUMMARY - name: Update version numbers in main - uses: nvidia/cccl/.github/actions/version-update@main + uses: ./.github/actions/version-update with: new_version: ${{ inputs.main_version }} target_branch: "main" diff --git a/.github/workflows/update-branch-version.yml b/.github/workflows/update-branch-version.yml index 9d15c7dbfee..e2c3b585fbe 100644 --- a/.github/workflows/update-branch-version.yml +++ b/.github/workflows/update-branch-version.yml @@ -56,7 +56,7 @@ jobs: ref: ${{ inputs.target_branch }} - name: Update version - uses: ${{ github.repository }}/.github/actions/version-update@main + uses: ./.github/actions/version-update with: new_version: ${{ inputs.new_version }} target_branch: ${{ inputs.target_branch }} From a6b068dea33b03646450b921af3783d86e5694ed Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 19 Nov 2024 01:15:40 +0000 Subject: [PATCH 6/8] Fixup missing shell in version update action --- .github/actions/version-update/action.yml | 193 +++++++++++----------- 1 file changed, 99 insertions(+), 94 deletions(-) diff --git a/.github/actions/version-update/action.yml b/.github/actions/version-update/action.yml index 1b182a33515..803598fa364 100644 --- a/.github/actions/version-update/action.yml +++ b/.github/actions/version-update/action.yml @@ -24,104 +24,109 @@ inputs: runs: using: "composite" steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - ref: ${{ inputs.target_branch }} - - - name: Prepare environment - id: prepare-env - run: | - log_and_export_vars() { - for var in "$@"; do - printf "%-15s %s\n" "$var:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY - echo "${var}=${!var}" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT - done - } - - full_version=${{ inputs.new_version }} - major_version=$(echo ${full_version} | cut -d. -f1) - minor_version=$(echo ${full_version} | cut -d. -f2) - patch_version=$(echo ${full_version} | cut -d. -f3) - branch_name=${{ inputs.target_branch }} - enable_force_push="${{ inputs.force }}" - pr_title="[Version] Update ${branch_name} to v${full_version}" - pr_body="Bump ${branch_name} to ${full_version}." - pr_branch="pr/ver/${branch_name}-v${full_version}" - - log_and_export_vars \ - full_version major_version minor_version patch_version \ - branch_name pr_title pr_branch pr_body enable_force_push - - echo "Branch ref: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY - echo "Branch SHA: $GITHUB_SHA" | tee -a $GITHUB_STEP_SUMMARY - echo "Branch commit: $(git show --oneline --no-patch ${GITHUB_SHA})" | tee -a $GITHUB_STEP_SUMMARY - - - name: Verify environment - id: verify-env - run: | - # Target branch must already exist - if ! git ls-remote --exit-code origin ${branch_name}; then - echo " Target branch must already exist" | tee -a $GITHUB_STEP_SUMMARY + shell: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.target_branch }} + + - name: Prepare environment + id: prepare-env + shell: bash --noprofile --norc -euo pipefail {0} + run: | + log_and_export_vars() { + for var in "$@"; do + printf "%-15s %s\n" "$var:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY + echo "${var}=${!var}" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT + done + } + + full_version=${{ inputs.new_version }} + major_version=$(echo ${full_version} | cut -d. -f1) + minor_version=$(echo ${full_version} | cut -d. -f2) + patch_version=$(echo ${full_version} | cut -d. -f3) + branch_name=${{ inputs.target_branch }} + enable_force_push="${{ inputs.force }}" + pr_title="[Version] Update ${branch_name} to v${full_version}" + pr_body="Bump ${branch_name} to ${full_version}." + pr_branch="pr/ver/${branch_name}-v${full_version}" + + log_and_export_vars \ + full_version major_version minor_version patch_version \ + branch_name pr_title pr_branch pr_body enable_force_push + + echo "Branch ref: $GITHUB_REF" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch SHA: $GITHUB_SHA" | tee -a $GITHUB_STEP_SUMMARY + echo "Branch commit: $(git show --oneline --no-patch ${GITHUB_SHA})" | tee -a $GITHUB_STEP_SUMMARY + + - name: Verify environment + id: verify-env + shell: bash --noprofile --norc -euo pipefail {0} + run: | + # Target branch must already exist + if ! git ls-remote --exit-code origin ${branch_name}; then + echo " Target branch must already exist" | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + + #Ensure that target branch version is compatible. + if [[ "${branch_name}" =~ ^branch/[0-9]+\.[0-9]+\.x$ ]]; then + branch_version=$(echo ${branch_name} | cut -d/ -f1 --complement) + branch_major=$(echo ${branch_version} | cut -d. -f1) + branch_minor=$(echo ${branch_version} | cut -d. -f2) + if [ "${branch_major}" != "${major_version}" ]; then + echo " Target branch major version mismatch" + exit 1 + fi; + if [ "${branch_minor}" != "${minor_version}" ]; then + echo " Target branch minor version mismatch" exit 1 fi + fi - #Ensure that target branch version is compatible. - if [[ "${branch_name}" =~ ^branch/[0-9]+\.[0-9]+\.x$ ]]; then - branch_version=$(echo ${branch_name} | cut -d/ -f1 --complement) - branch_major=$(echo ${branch_version} | cut -d. -f1) - branch_minor=$(echo ${branch_version} | cut -d. -f2) - if [ "${branch_major}" != "${major_version}" ]; then - echo " Target branch major version mismatch" - exit 1 - fi; - if [ "${branch_minor}" != "${minor_version}" ]; then - echo " Target branch minor version mismatch" - exit 1 - fi - fi - - # PR branch must *not* exist - if [ "${enable_force_push}" == "false" ]; then - if git ls-remote --exit-code origin ${pr_branch}; then - echo " PR branch cannot already exist - Delete branch and retry workflow or enable 'force'" | tee -a $GITHUB_STEP_SUMMARY - exit 1 - fi - fi - - if [[ ! $full_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Invalid version number: $full_version" + # PR branch must *not* exist + if [ "${enable_force_push}" == "false" ]; then + if git ls-remote --exit-code origin ${pr_branch}; then + echo " PR branch cannot already exist - Delete branch and retry workflow or enable 'force'" | tee -a $GITHUB_STEP_SUMMARY exit 1 fi - - - name: Update version numbers in target branch - id: create-pr-branch - run: | - git checkout -b ${pr_branch} - echo "::group::Running update_version.sh" - ./ci/update_version.sh ${major_version} ${minor_version} ${patch_version} + fi + + if [[ ! $full_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version number: $full_version" + exit 1 + fi + + - name: Update version numbers in target branch + id: create-pr-branch + shell: bash --noprofile --norc -euo pipefail {0} + run: | + git checkout -b ${pr_branch} + echo "::group::Running update_version.sh" + ./ci/update_version.sh ${major_version} ${minor_version} ${patch_version} + echo "::endgroup::" + + if ! git diff --quiet; then + echo "::group::Diff" + git diff echo "::endgroup::" - if ! git diff --quiet; then - echo "::group::Diff" - git diff - echo "::endgroup::" - - git add . - - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "${pr_body}" - - # Push the changes to the release branch: - git push --force origin ${pr_branch} - fi - - - name: Create pull request for target branch - id: create-pr - run: | - gh pr create \ - -B "${branch_name}" \ - -b "${pr_body}" \ - -t "${pr_title}" \ - -H "${pr_branch}" + git add . + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "${pr_body}" + + # Push the changes to the release branch: + git push --force origin ${pr_branch} + fi + + - name: Create pull request for target branch + id: create-pr + shell: bash --noprofile --norc -euo pipefail {0} + run: | + gh pr create \ + -B "${branch_name}" \ + -b "${pr_body}" \ + -t "${pr_title}" \ + -H "${pr_branch}" From daab66941b1d0bf6870552ec9a706072bfd63c8b Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 19 Nov 2024 01:19:17 +0000 Subject: [PATCH 7/8] Fixup extra shell in version update action --- .github/actions/version-update/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/version-update/action.yml b/.github/actions/version-update/action.yml index 803598fa364..7b084a5726a 100644 --- a/.github/actions/version-update/action.yml +++ b/.github/actions/version-update/action.yml @@ -24,7 +24,7 @@ inputs: runs: using: "composite" steps: - shell: + - name: Checkout the repository uses: actions/checkout@v4 with: From b51d95e4033f7d247c11c8552d39920422f0fe91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:21:36 +0000 Subject: [PATCH 8/8] Bump main to 2.9.0. --- cccl-version.json | 4 ++-- cub/cub/version.cuh | 2 +- lib/cmake/cccl/cccl-config-version.cmake | 2 +- lib/cmake/cub/cub-config-version.cmake | 2 +- lib/cmake/cudax/cudax-config-version.cmake | 2 +- lib/cmake/libcudacxx/libcudacxx-config-version.cmake | 2 +- lib/cmake/thrust/thrust-config-version.cmake | 2 +- libcudacxx/include/cuda/std/__cccl/version.h | 2 +- python/cuda_cooperative/cuda/cooperative/_version.py | 2 +- python/cuda_parallel/cuda/parallel/_version.py | 2 +- thrust/thrust/version.h | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cccl-version.json b/cccl-version.json index fc6b155463e..a07ae98e6fd 100644 --- a/cccl-version.json +++ b/cccl-version.json @@ -1,6 +1,6 @@ { - "full": "2.8.0", + "full": "2.9.0", "major": 2, - "minor": 8, + "minor": 9, "patch": 0 } diff --git a/cub/cub/version.cuh b/cub/cub/version.cuh index 2d5232939c8..ee57e435e69 100644 --- a/cub/cub/version.cuh +++ b/cub/cub/version.cuh @@ -58,7 +58,7 @@ * CUB_VERSION / 100 % 1000 is the minor version. * CUB_VERSION / 100000 is the major version. */ -#define CUB_VERSION 200800 // macro expansion with ## requires this to be a single value +#define CUB_VERSION 200900 // macro expansion with ## requires this to be a single value /*! \def CUB_MAJOR_VERSION * \brief The preprocessor macro \p CUB_MAJOR_VERSION encodes the diff --git a/lib/cmake/cccl/cccl-config-version.cmake b/lib/cmake/cccl/cccl-config-version.cmake index e19e23cc7f1..ddc74d7e577 100644 --- a/lib/cmake/cccl/cccl-config-version.cmake +++ b/lib/cmake/cccl/cccl-config-version.cmake @@ -1,5 +1,5 @@ set(CCCL_VERSION_MAJOR 2) -set(CCCL_VERSION_MINOR 8) +set(CCCL_VERSION_MINOR 9) set(CCCL_VERSION_PATCH 0) set(CCCL_VERSION_TWEAK 0) diff --git a/lib/cmake/cub/cub-config-version.cmake b/lib/cmake/cub/cub-config-version.cmake index 684d81af37f..ff8252252e2 100644 --- a/lib/cmake/cub/cub-config-version.cmake +++ b/lib/cmake/cub/cub-config-version.cmake @@ -2,7 +2,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/cub-header-search.cmake") set(CUB_VERSION_MAJOR 2) -set(CUB_VERSION_MINOR 8) +set(CUB_VERSION_MINOR 9) set(CUB_VERSION_PATCH 0) set(CUB_VERSION_TWEAK 0) set(CUB_VERSION "${CUB_VERSION_MAJOR}.${CUB_VERSION_MINOR}.${CUB_VERSION_PATCH}.${CUB_VERSION_TWEAK}") diff --git a/lib/cmake/cudax/cudax-config-version.cmake b/lib/cmake/cudax/cudax-config-version.cmake index 18de91cf056..7b7ab9a9621 100644 --- a/lib/cmake/cudax/cudax-config-version.cmake +++ b/lib/cmake/cudax/cudax-config-version.cmake @@ -1,5 +1,5 @@ set(cudax_VERSION_MAJOR 2) -set(cudax_VERSION_MINOR 8) +set(cudax_VERSION_MINOR 9) set(cudax_VERSION_PATCH 0) set(cudax_VERSION_TWEAK 0) diff --git a/lib/cmake/libcudacxx/libcudacxx-config-version.cmake b/lib/cmake/libcudacxx/libcudacxx-config-version.cmake index 09af8c9cdd9..8fa72039f70 100644 --- a/lib/cmake/libcudacxx/libcudacxx-config-version.cmake +++ b/lib/cmake/libcudacxx/libcudacxx-config-version.cmake @@ -2,7 +2,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/libcudacxx-header-search.cmake") set(libcudacxx_VERSION_MAJOR 2) -set(libcudacxx_VERSION_MINOR 8) +set(libcudacxx_VERSION_MINOR 9) set(libcudacxx_VERSION_PATCH 0) set(libcudacxx_VERSION_TWEAK 0) diff --git a/lib/cmake/thrust/thrust-config-version.cmake b/lib/cmake/thrust/thrust-config-version.cmake index 5e206f1c78a..812e5637553 100644 --- a/lib/cmake/thrust/thrust-config-version.cmake +++ b/lib/cmake/thrust/thrust-config-version.cmake @@ -2,7 +2,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/thrust-header-search.cmake") set(THRUST_VERSION_MAJOR 2) -set(THRUST_VERSION_MINOR 8) +set(THRUST_VERSION_MINOR 9) set(THRUST_VERSION_PATCH 0) # Thrust: "subminor" CMake: "patch" set(THRUST_VERSION_TWEAK 0) set(THRUST_VERSION "${THRUST_VERSION_MAJOR}.${THRUST_VERSION_MINOR}.${THRUST_VERSION_PATCH}.${THRUST_VERSION_TWEAK}") diff --git a/libcudacxx/include/cuda/std/__cccl/version.h b/libcudacxx/include/cuda/std/__cccl/version.h index 9bf8b38d625..f82ecae48d3 100644 --- a/libcudacxx/include/cuda/std/__cccl/version.h +++ b/libcudacxx/include/cuda/std/__cccl/version.h @@ -14,7 +14,7 @@ #ifndef __CCCL_VERSION_H #define __CCCL_VERSION_H -#define CCCL_VERSION 2008000 +#define CCCL_VERSION 2009000 #define CCCL_MAJOR_VERSION (CCCL_VERSION / 1000000) #define CCCL_MINOR_VERSION (((CCCL_VERSION / 1000) % 1000)) #define CCCL_PATCH_VERSION (CCCL_VERSION % 1000) diff --git a/python/cuda_cooperative/cuda/cooperative/_version.py b/python/cuda_cooperative/cuda/cooperative/_version.py index 63cedf944ad..35a9805ab0a 100644 --- a/python/cuda_cooperative/cuda/cooperative/_version.py +++ b/python/cuda_cooperative/cuda/cooperative/_version.py @@ -4,4 +4,4 @@ # This file is generated by ci/update_version.sh # Do not edit this file manually. -__version__ = "0.1.2.8.0" +__version__ = "0.1.2.9.0" diff --git a/python/cuda_parallel/cuda/parallel/_version.py b/python/cuda_parallel/cuda/parallel/_version.py index 63cedf944ad..35a9805ab0a 100644 --- a/python/cuda_parallel/cuda/parallel/_version.py +++ b/python/cuda_parallel/cuda/parallel/_version.py @@ -4,4 +4,4 @@ # This file is generated by ci/update_version.sh # Do not edit this file manually. -__version__ = "0.1.2.8.0" +__version__ = "0.1.2.9.0" diff --git a/thrust/thrust/version.h b/thrust/thrust/version.h index 93fef258747..05cab6a1566 100644 --- a/thrust/thrust/version.h +++ b/thrust/thrust/version.h @@ -61,7 +61,7 @@ * THRUST_VERSION / 100 % 1000 is the minor version. * THRUST_VERSION / 100000 is the major version. */ -#define THRUST_VERSION 200800 // macro expansion with ## requires this to be a single value +#define THRUST_VERSION 200900 // macro expansion with ## requires this to be a single value /*! \def THRUST_MAJOR_VERSION * \brief The preprocessor macro \p THRUST_MAJOR_VERSION encodes the