forked from NVIDIA/cccl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes NVIDIA#653. Adds three new workflows that can be manually triggered at various points in the release process: - `release-create-new`: Begin the release process for a new version. - Inputs: - `new_version`: The new version, eg. "2.3.1" - `branch_point`: Optional; If the `branch/{major}.{minor}.x` branch does not exist, create it from this SHA. If the release branch already exists, this is ignored. If not provided, the release branch is created from the current `main` branch. - Actions: - Creates release branch if needed. - Bumps version numbers with `update-version.sh` in topic branch. - Creates pull request to merge the topic branch into `main` - Marks the pull request for backporting to the release branch. - `release-update-rc`: Validate and tag a new release candidate. - Inputs: - `new_version`: The new version, eg. "2.3.1" - Actions: - Uses the HEAD SHA of the release branch for testing/tagging. - Determines the next rc for this version by inspecting existing tags. - Runs the `pull_request` workflow to validate the release candidate. This can be modified in the future to run a special rc acceptance workflow. - Tags the release candidate if the workflow passes. - `release-finalize`: Tag a final release. - Inputs: - `new_version`: The new version, eg. "2.3.1" - Actions: - Determines the most recent release candidate. - Tags the latest release candidate as the final release. [skip-matrix][skip-rapids][skip-vdc][skip-docs]
- Loading branch information
1 parent
2f8aa7d
commit 37fa33a
Showing
3 changed files
with
422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# 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" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
new_version: | ||
description: "Semantic version string (eg. '2.3.0')" | ||
type: string | ||
required: true | ||
branch_point: | ||
description: "If the release branch doesn't exist yet, it will be branched from this ref." | ||
type: string | ||
required: true | ||
default: 'main' | ||
|
||
defaults: | ||
run: | ||
shell: bash --noprofile --norc -euo pipefail {0} | ||
|
||
jobs: | ||
create-release-branch: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare environment | ||
id: prepare-env | ||
run: | | ||
log_and_export_vars() { | ||
for var in "$@"; do | ||
var_name=${var^^} | ||
printf "%-15s %s\n" "$var_name:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY | ||
echo "${var_name}=${!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="branch/${major_version}.${minor_version}.x" | ||
log_and_export_vars full_version major_version minor_version patch_version branch_name | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Create release branch if needed | ||
id: create_branch | ||
run: | | ||
# Create the release branch if it doesn't already exist: | ||
if git ls-remote --exit-code origin $BRANCH_NAME; then | ||
echo "Branch $BRANCH_NAME already exists." | tee -a $GITHUB_STEP_SUMMARY | ||
else | ||
git checkout ${{inputs.branch_point}} | ||
git checkout -b $BRANCH_NAME | ||
git push origin $BRANCH_NAME:$BRANCH_NAME | ||
echo "Created branch $BRANCH_NAME at:\n$(git show HEAD)" | tee -a $GITHUB_STEP_SUMMARY | ||
fi | ||
- name: Update version numbers | ||
run: | | ||
git checkout main | ||
git checkout -b bump_version_${major_version}.${minor_version}.${patch_version} | ||
echo "::group::Running update-version.sh" | ||
./ci/update-version.sh ${MAJOR_VERSION} ${MINOR_VERSION} ${PATCH_VERSION} | ||
echo "::endgroup::" | ||
echo "::group::Diff" | ||
git diff | ||
echo "::endgroup::" | ||
git add . | ||
git commit -m "Bump version to ${FULL_VERSION}." | ||
- name: Create a pull request | ||
id: create_pr | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
branch: ${{ steps.prepare-env.outputs.BRANCH_NAME }} | ||
title: 'Bump version to ${{ steps.prepare-env.outputs.FULL_VERSION }}' | ||
body: 'This PR was automatically generated by the release-create-new workflow.' | ||
base: main | ||
|
||
- name: Add backport comment | ||
run: | | ||
echo "/backport $BRANCH_NAME" | gh issue comment ${{ steps.create_pr.outputs.pull-request-number }} -F - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# 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: 3. Tag Final Release" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
new_version: | ||
type: string | ||
description: "Semantic version string (eg. '2.3.0')" | ||
required: true | ||
|
||
defaults: | ||
run: | ||
shell: bash --noprofile --norc -euo pipefail {0} | ||
|
||
jobs: | ||
tag-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
rc_tag: ${{ steps.prepare.outputs.rc_tag }} | ||
release_tag: ${{ steps.prepare.outputs.release_tag }} | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Prepare environment | ||
id: prepare | ||
run: | | ||
log_and_export_vars() { | ||
for var in "$@"; do | ||
var_name=${var^^} | ||
printf "%-15s %s\n" "$var_name:" "${!var}" | tee -a $GITHUB_STEP_SUMMARY | ||
echo "${var_name}=${!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) | ||
release_tag="v${full_version}" | ||
release_tag_escaped=$(echo "${release_tag}" | sed 's/\./\\./g') | ||
log_and_export_vars full_version major_version minor_version patch_version release_tag | ||
# Ensure that there is no final release tag (vX.Y.Z) for the requested version. | ||
if git ls-remote --tags origin | grep -q "refs/tags/${release_tag_escaped}$"; then | ||
echo "::error::Tag ${release_tag} already exists." | ||
exit 1 | ||
fi | ||
fi | ||
# Look for previous release candidates: | ||
declare -i last_rc= | ||
for tag in $(git ls-remote --tags origin; do | ||
if [[ $tag =~ v${full_version}-rc([0-9]+)$ ]]; then | ||
rc=${BASH_REMATCH[1]} | ||
if (( rc > last_rc )); then | ||
last_rc=rc | ||
fi | ||
fi | ||
done | ||
if [[ -z $last_rc ]]; then | ||
echo "::error::No release candidates found for version ${full_version}." | ||
fi | ||
# Determine tag name | ||
rc_tag="v${full_version}-rc${last_rc}" | ||
log_and_export_vars last_rc rc_tag | ||
- name: Tag | ||
run: | | ||
git tag ${{ steps.prepare.outputs.release_tag }} ${{ steps.prepare.outputs.rc_tag }} | ||
git push origin ${{ steps.prepare.outputs.release_tag }} | ||
echo "Tagged release ${release_tag}." | ||
# TODO Notify team of results. |
Oops, something went wrong.