forked from pulp/pulp-2to3-migration
-
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.
Required PR: pulp/pulp_container#355 [noissue]
- Loading branch information
1 parent
656586d
commit eff5426
Showing
6 changed files
with
179 additions
and
7 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,79 @@ | ||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github pulp_2to3_migration' to update this file. | ||
# | ||
# For more info visit https://github.com/pulp/plugin_template | ||
--- | ||
name: Create New Release Branch | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
description: "Branch name (e.g. 3.14)" | ||
required: true | ||
|
||
env: | ||
RELEASE_WORKFLOW: true | ||
|
||
jobs: | ||
create-branch: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# by default, it uses a depth of 1 | ||
# this fetches all history so that we can read each commit | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.7" | ||
|
||
- name: Install python dependencies | ||
run: | | ||
echo ::group::PYDEPS | ||
pip install bump2version | ||
echo ::endgroup:: | ||
- name: Setting secrets | ||
run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" | ||
env: | ||
SECRETS_CONTEXT: ${{ toJson(secrets) }} | ||
|
||
- name: Verify that branch name matches current version string on master branch | ||
run: | | ||
X_Y_VERSION=$(grep version setup.py | sed -rn 's/version="(.*)\.0\.dev",/\1/p' | awk '{$1=$1};1') | ||
if [[ "$X_Y_VERSION" != "${{ github.event.inputs.name }}" ]] | ||
then | ||
echo "Branch name doesn't match the current version string $X_Y_VERSION." | ||
exit 1 | ||
fi | ||
- name: Create ${{ github.event.inputs.name }} release branch | ||
run: | | ||
git checkout -b ${{ github.event.inputs.name }} | ||
git push origin ${{ github.event.inputs.name }} | ||
- name: Bump version on master branch | ||
run: | | ||
git checkout master | ||
bump2version --no-commit minor | ||
- name: Make a PR with version bump | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
committer: pulpbot <pulp-infra@redhat.com> | ||
author: pulpbot <pulp-infra@redhat.com> | ||
branch: minor-version-bump | ||
base: master | ||
title: Bump minor version | ||
body: '[noissue]' | ||
commit-message: | | ||
Bump minor version | ||
[noissue] | ||
delete-branch: true |
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
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
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
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
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,57 @@ | ||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github pulp_2to3_migration' to update this file. | ||
# | ||
# For more info visit https://github.com/pulp/plugin_template | ||
|
||
import argparse | ||
import os | ||
import textwrap | ||
|
||
from git import Repo | ||
|
||
|
||
helper = textwrap.dedent( | ||
"""\ | ||
Stage the changelog for a release on master branch. | ||
Example: | ||
$ python .github/workflows/scripts/stage-changelog-for-master.py 3.4.0 | ||
""" | ||
) | ||
|
||
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper) | ||
|
||
parser.add_argument( | ||
"release_version", | ||
type=str, | ||
help="The version string for the release.", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
release_version_arg = args.release_version | ||
|
||
release_path = os.path.dirname(os.path.abspath(__file__)) | ||
plugin_path = release_path.split("/.github")[0] | ||
|
||
print(f"\n\nRepo path: {plugin_path}") | ||
repo = Repo(plugin_path) | ||
|
||
changelog_commit = None | ||
# Look for a commit with the requested release version | ||
for commit in repo.iter_commits(): | ||
if f"Building changelog for {release_version_arg}\n" in commit.message: | ||
changelog_commit = commit | ||
break | ||
|
||
if not changelog_commit: | ||
raise RuntimeError("Changelog commit for {release_version_arg} was not found.") | ||
|
||
git = repo.git | ||
git.stash() | ||
git.checkout("origin/master") | ||
git.cherry_pick(changelog_commit.hexsha) | ||
git.reset("origin/master") |