Fix version handling issues in release workflow. (#12375)
* Pass `nightly` instead of a version for nightly builds. * Use the correct name for the version input when triggering builds. * Properly pull the version info for nightly builds in the packaging workflow.
Austin S. Hemmelgarn committed
Mar 11, 2022 at 08:59 UTC
5fdcd854ec809079a59173d1d13ea28eb7fb92e6
3 files changed
+9
-8
.github/scripts/prepare-release-base.sh
+4
-3
@@ -108,6 +108,7 @@ elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then
108
echo "::set-output name=ref::master"
109
echo "::set-output name=type::nightly"
110
echo "::set-output name=branch::master"
111
+ echo "::set-output name=version::nightly"
112
elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
113
echo "::notice::Preparing a patch release build."
114
check_version_format || exit 1
@@ -127,6 +128,7 @@ elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
128
echo "::set-output name=ref::${EVENT_VERSION}"
129
echo "::set-output name=type::release"
130
echo "::set-output name=branch::${branch_name}"
131
+ echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
132
elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
133
echo "::notice::Preparing a minor release build."
134
check_version_format || exit 1
@@ -147,6 +149,7 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
149
echo "::set-output name=ref::${EVENT_VERSION}"
150
echo "::set-output name=type::release"
151
echo "::set-output name=branch::${branch_name}"
152
+ echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
153
elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
154
echo "::notice::Preparing a major release build."
155
check_version_format || exit 1
@@ -160,10 +163,8 @@ elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
163
echo "::set-output name=ref::${EVENT_VERSION}"
164
echo "::set-output name=type::release"
165
echo "::set-output name=branch::master"
166
+ echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
167
else
168
echo '::error::Unrecognized release type or invalid version.'
169
exit 1
170
fi
167
-
168
-# shellcheck disable=SC2002
169
-echo "::set-output name=version::$(cat packaging/version | sed 's/^v//' packaging/version)"
.github/workflows/packaging.yml
+2
-2
@@ -121,7 +121,7 @@ jobs:
121
;;
122
"nightly")
123
echo "::set-output name=repo::${REPO_PREFIX}-edge"
124
- echo "::set-output name=version::${{ github.event.inputs.version }}"
124
+ echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
125
echo "::set-output name=retention::30"
126
;;
127
*)
@@ -131,7 +131,7 @@ jobs:
131
;;
132
esac
133
else
134
- echo "::set-output name=version::$(cut -d'-' -f 1 packaging/version | sed -e 's/^v//')"
134
+ echo "::set-output name=version::$(cut -d'-' -f 1 packaging/version | tr -d 'v')"
135
echo "::set-output name=retention::0"
136
fi
137
- name: Failure Notification
.github/workflows/release.yml
+3
-3
@@ -119,7 +119,7 @@ jobs:
119
repo: ${{ github.repository }}
120
workflow: Build
121
ref: ${{ needs.update-changelogs.outputs.ref }}
122
- inputs: '{"agent_version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ github.event.inputs.type }}"}'
122
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ github.event.inputs.type }}"}'
123
- name: Failure Notification
124
uses: rtCamp/action-slack-notify@v2
125
env:
@@ -154,7 +154,7 @@ jobs:
154
repo: ${{ github.repository }}
155
workflow: Docker
156
ref: ${{ needs.update-changelogs.outputs.ref }}
157
- inputs: '{"agent_version": "${{ needs.update-changelogs.outputs.version }}"}'
157
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}"}'
158
- name: Failure Notification
159
uses: rtCamp/action-slack-notify@v2
160
env:
@@ -189,7 +189,7 @@ jobs:
189
repo: ${{ github.repository }}
190
workflow: Packages
191
ref: ${{ needs.update-changelogs.outputs.ref }}
192
- inputs: '{"agent_version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ github.event.inputs.type }}"}'
192
+ inputs: '{"version": "${{ needs.update-changelogs.outputs.version }}", "type": "${{ github.event.inputs.type }}"}'
193
- name: Failure Notification
194
uses: rtCamp/action-slack-notify@v2
195
env: