-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automation to create a release branch
- Loading branch information
Showing
2 changed files
with
78 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,32 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
BRANCH="$(git branch --show-current)" | ||
|
||
if ! [[ "${BRANCH}" = "develop" ]] | ||
then | ||
echo ERROR: This is not the main branch! | ||
exit 1 | ||
fi | ||
|
||
NEW_VERSION="$(bump-my-version show new_version --increment release | sed -Ene 's/^([[:digit:]]+\.[[:digit:]]+)\.[[:digit:]]+$/\1/p')" | ||
|
||
if [[ -z "${NEW_VERSION}" ]] | ||
then | ||
echo ERROR: Could not parse new version. | ||
exit 1 | ||
fi | ||
|
||
NEW_BRANCH="RELEASE-${NEW_VERSION}" | ||
|
||
git branch "${NEW_BRANCH}" | ||
|
||
bump-my-version bump minor --commit --message $'Bump version to {new_version}' --allow-dirty | ||
|
||
git push origin "${NEW_BRANCH}" | ||
|
||
if [ "${GITHUB_ENV:-}" ] | ||
then | ||
echo "NEW_BRANCH=${NEW_BRANCH}" >> "${GITHUB_ENV}" | ||
fi |
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,46 @@ | ||
--- | ||
name: "Create Release Branch" | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create-release-branch: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v4" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "3.13" | ||
- name: "Setup git" | ||
run: | | ||
git config user.name pulpbot | ||
git config user.email [email protected] | ||
- name: "Install python dependencies" | ||
run: | | ||
pip install bump-my-version~=0.29.0 | ||
- name: "Create Release Branch" | ||
run: | | ||
.ci/scripts/create_release_branch.sh | ||
- name: "Create Pull Request" | ||
uses: "peter-evans/create-pull-request@v7" | ||
with: | ||
token: "${{ secrets.RELEASE_TOKEN }}" | ||
title: "Bump dev-version" | ||
body: "" | ||
branch: "bump_version" | ||
delete-branch: true | ||
- name: "Add Backport Label for new Branch" | ||
uses: "actions/github-script@v7" | ||
with: | ||
script: | | ||
const { NEW_BRANCH } = process.env; | ||
const labelName = "backport-" + NEW_BRANCH; | ||
await github.rest.issues.createLabel({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: labelName, | ||
color: "C8780A", | ||
}); | ||
... |