Fix branch handling for minor releases in release workflow. (#12690)
Austin S. Hemmelgarn committed
Apr 15, 2022 at 08:16 UTC
1b8b7b7efddc574dcb0d3a68e4ceab46397fc3b9
2 files changed
+10
-5
.github/scripts/prepare-release-base.sh
+2
-3
@@ -148,14 +148,13 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
148
echo "::error::A branch named ${branch_name} already exists in the repository."
149
exit 1
150
fi
151
- git branch "${branch_name}"
152
- git checkout "${branch_name}"
151
echo "${EVENT_VERSION}" > packaging/version || exit 1
152
echo "::set-output name=run::true"
153
echo "::set-output name=message::Minor release ${EVENT_VERSION}."
154
echo "::set-output name=ref::${EVENT_VERSION}"
155
echo "::set-output name=type::release"
158
- echo "::set-output name=branch::${branch_name}"
156
+ echo "::set-output name=branch::master"
157
+ echo "::set-output name=new-branch:${branch_name}"
158
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
159
elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
160
echo "::notice::Preparing a major release build."
.github/workflows/release.yml
+8
-2
@@ -80,9 +80,15 @@ jobs:
80
git add packaging/version CHANGELOG.md
81
git commit -m "[ci skip] ${{ steps.target.outputs.message }}"
82
if [ "${{ steps.target.outputs.type }}" != "nightly" ]; then
83
- git tag ${{ github.event.inputs.version }}
83
+ git tag "${{ github.event.inputs.version }}"
84
+ fi
85
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
86
+ git branch "${{ steps.target.outputs.new-branch }}"
87
+ fi
88
+ git push --tags origin "${{ steps.target.outputs.branch }}"
89
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
90
+ git push origin "${{ steps.target.outputs.new-branch }}"
91
fi
85
- git push --follow-tags origin ${{ steps.target.outputs.branch }}
92
- name: Failure Notification
93
uses: rtCamp/action-slack-notify@v2
94
env: