Skip to content

Commit 2791c60

Browse files
ShahanaFarooquirustyrussell
authored andcommitted
ci: Removed branch testing due to checkout confusion between branch vs tag
- Removed branch testing as it is not required. Point releases will trigger the event due to `tag` push even when it is not from master branch. - Added version in inputs for testing - Added missing `inputs` tag Changelog-None.
1 parent f2b4b50 commit 2791c60

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/release.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
- 'v[0-9]+.[0-9]+.[0-9]+'
99
- 'v[0-9]+.[0-9]+[0-9a-z]+'
1010
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Release version'
14+
required: true
1115
create_release:
1216
description: Create a draft release
1317
default: no
@@ -28,14 +32,18 @@ jobs:
2832
with:
2933
fetch-tags: true
3034

31-
- name: Determine version from pushed tag
32-
if: ${{ github.ref_type == 'tag' }}
33-
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
34-
35-
# Relevant for testing branches.
36-
- name: Determine version from pushed branch tag
37-
if: ${{ github.ref_type == 'branch' }}
38-
run: echo "VERSION=$(git tag --points-at HEAD)" >> "$GITHUB_ENV"
35+
- name: Determine version
36+
run: |
37+
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
38+
VERSION="${{ github.event.inputs.version }}"
39+
elif [ "${{ github.ref_type }}" == "tag" ]; then
40+
VERSION="${{ github.ref_name }}"
41+
else
42+
echo "No release version provided and no tag found."
43+
exit 1
44+
fi
45+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
46+
echo "Determined version: $VERSION"
3947
4048
- name: Validate release
4149
run: tools/check-release.sh --version=${VERSION}
@@ -170,7 +178,7 @@ jobs:
170178
echo "release_title=$RELEASE_TITLE" >> "$GITHUB_OUTPUT"
171179
172180
- name: Prepare release draft
173-
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.create_release == 'yes')
181+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'yes')
174182
uses: softprops/action-gh-release@v2
175183
with:
176184
name: "${{ env.version }} ${{ steps.release_data.outputs.release_title }}"

0 commit comments

Comments
 (0)