Skip to content

Commit

Permalink
Handle feature branch separately from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
rvermeulen committed Sep 14, 2023
1 parent 957f959 commit 8479dd3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,19 @@ jobs:
echo "Release branch rc/$RELEASE_VERSION does not exist."
echo "create_release_branch=true" >> "$GITHUB_ENV"
echo "create_release_pr=true" >> "$GITHUB_ENV"
echo "create_release_feature_branch=true" >> "$GITHUB_ENV"
else
echo "Release branch rc/$RELEASE_VERSION already exists."
echo "create_release_branch=false" >> "$GITHUB_ENV"
if [[ -z $(git ls-remote --heads origin feature/update-user-manual-for-$RELEASE_VERSION) ]]; then
echo "Feature branch feature/update-user-manual-for-$RELEASE_VERSION does not exist."
echo "create_release_feature_branch=true" >> "$GITHUB_ENV"
else
echo "Feature branch feature/update-user-manual-for-$RELEASE_VERSION already exists."
echo "create_release_feature_branch=false" >> "$GITHUB_ENV"
fi
pr_state=$(gh pr view rc/$RELEASE_VERSION --json title,state)
pr_title=$(echo "$pr_state" | jq -r '.title')
pr_state=$(echo "$pr_state" | jq -r '.state')
Expand Down Expand Up @@ -109,13 +118,13 @@ jobs:
$RELEASE_VERSION
- name: Create feature branch for PR
if: env.create_release_pr == 'true'
if: env.create_release_feature_branch == 'true'
run: |
git switch -c feature/update-user-manual-for-$RELEASE_VERSION
git push --set-upstream origin feature/update-user-manual-for-$RELEASE_VERSION
- name: Get feature branch for PR
if: env.create_release_pr == 'false'
if: env.create_release_feature_branch == 'false'
run: |
git fetch origin feature/update-user-manual-for-$RELEASE_VERSION
git switch feature/update-user-manual-for-$RELEASE_VERSION
Expand All @@ -129,7 +138,7 @@ jobs:
find docs -name 'user_manual.md' | xargs sed -i "s/user_manual_.*\.md\`/user_manual_$RELEASE_VERSION.md\`/"
find docs -name 'user_manual.md' | xargs sed -i "s/This user manual documents release \`.*\` of/This user manual documents release \`$RELEASE_VERSION\` of/"
if git diff --quiet; then
if ! git diff --quiet; then
git add -u .
git commit -m "Update version"
git push
Expand Down

0 comments on commit 8479dd3

Please sign in to comment.