Skip to content

Commit

Permalink
Merge pull request #153 from gerrod3/test-create-branch
Browse files Browse the repository at this point in the history
Testing create branch workflow
  • Loading branch information
gerrod3 committed Jul 12, 2023
2 parents ee78e0c + 2200629 commit 59b5a9b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-228-g9949044
2021.08.26-227-g0a28ffe-dirty
35 changes: 31 additions & 4 deletions .github/workflows/create-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ on:
name:
description: "Branch name (e.g. 3.14)"
required: true
update_ci_branches:
description: "Behavior for updating ci_update_branches"
required: true
type: choice
default: none
options:
- append-version
- replace-previous-version
- none

env:
RELEASE_WORKFLOW: true
Expand Down Expand Up @@ -47,16 +56,16 @@ jobs:
- name: Verify that branch name matches current version string on main branch
run: |
X_Y_VERSION=$(grep version setup.py | sed -rn 's/version="(.*)\.0((a[0-9]+)|(b[0-9]+))?\.dev",/\1/p' | awk '{$1=$1};1')
if [[ "$X_Y_VERSION" != "${{ github.event.inputs.name }}" ]]
if [[ "$X_Y_VERSION" != "${{ 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
- name: Create ${{ inputs.name }} release branch
run: |
git checkout -b ${{ github.event.inputs.name }}
git push origin ${{ github.event.inputs.name }}
git checkout -b ${{ inputs.name }}
git push origin ${{ inputs.name }}
- name: Bump version on main branch
run: |
Expand All @@ -67,6 +76,24 @@ jobs:
run: |
find CHANGES -type f -regex ".*\.\(bugfix\|doc\|feature\|misc\|deprecation\|removal\)" -exec git rm {} +
- uses: actions/checkout@v3
if: "$inputs.update_ci_branches" != "none"
with:
repository: pulp/plugin_template
path: plugin_template
fetch-depth: 0

- name: Update CI branches in template_config
if: "$inputs.update_ci_branches" != "none"
working-directory: plugin_template
run: |
ARGS="--add-version-ci-update-branches ${{ inputs.name }}"
if [ ${{ inputs.update_ci_branches }} == "replace-previous-version" ]; then
ARGS="$ARGS --replace-previous-version-ci-update-branches"
fi
python3 ./plugin-template pulpcore --github $ARGS
git add -A
- name: Make a PR with version bump and without CHANGES/*
uses: peter-evans/create-pull-request@v4
with:
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/scripts/update_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ if [ ! -f "template_config.yml" ]; then
fi

pushd ../plugin_template
./plugin-template --github --docs pulpcore
./plugin-template --github pulpcore
popd

# Check if only gitref file has changed, so no effect on CI workflows.
if [ "$(git diff --name-only | grep -v "template_gitref")" ]; then
echo "No changes detected."
git restore ".github/template_gitref" "docs/template_gitref"
if [[ $(git diff --name-only) == ".github/template_gitref" ]]; then
echo "No changes detected in github section."
git restore ".github/template_gitref"
fi

pushd ../plugin_template
./plugin-template --docs pulpcore
popd

# Check if only gitref file has changed, so no effect on CI workflows.
if [[ $(git diff --name-only) == "docs/template_gitref" ]]; then
echo "No changes detected in docs section."
git restore "docs/template_gitref"
fi

if [[ $(git status --porcelain) ]]; then
Expand Down

0 comments on commit 59b5a9b

Please sign in to comment.