Skip to content

Commit 732f76f

Browse files
committed
fix: simplify version retrieval logic and remove unused input parameter
1 parent acb54dd commit 732f76f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.github/workflows/update_version.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7-
inputs:
8-
version:
9-
description: 'Version to use (leave empty to use latest release)'
10-
required: false
11-
type: string
127

138
permissions:
149
contents: read
@@ -17,7 +12,7 @@ jobs:
1712
update-version:
1813
runs-on: ubuntu-latest
1914
outputs:
20-
version: ${{ steps.get_version.outputs.version }}
15+
version: ${{ steps.process_version.outputs.version }}
2116
permissions:
2217
contents: write
2318
pull-requests: write
@@ -30,27 +25,32 @@ jobs:
3025
- name: Get version
3126
id: get_version
3227
run: |
33-
if [ -n "${INPUT_VERSION}" ]; then
34-
VERSION="${INPUT_VERSION}"
35-
elif [ "${EVENT_NAME}" = "release" ]; then
36-
VERSION="${RELEASE_TAG}"
28+
if [ "${EVENT_NAME}" = "release" ]; then
29+
echo "version=${RELEASE_TAG}" >> $GITHUB_OUTPUT
3730
else
3831
VERSION=$(git describe --tags --abbrev=0)
32+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
3933
fi
40-
34+
env:
35+
EVENT_NAME: ${{ github.event_name }}
36+
RELEASE_TAG: ${{ github.event.release.tag_name }}
37+
38+
- name: Process version
39+
id: process_version
40+
run: |
41+
VERSION="${RAW_VERSION}"
4142
# Remove 'v' prefix if present
4243
VERSION="${VERSION#v}"
4344
4445
echo "VERSION=${VERSION}" >> $GITHUB_ENV
4546
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4647
env:
47-
GH_TOKEN: ${{ github.token }}
48-
INPUT_VERSION: ${{ inputs.version }}
49-
EVENT_NAME: ${{ github.event_name }}
50-
RELEASE_TAG: ${{ github.event.release.tag_name }}
48+
RAW_VERSION: ${{ steps.get_version.outputs.version }}
5149

5250
- name: Write version to version.txt
53-
run: echo "${{ env.VERSION }}" > version.txt
51+
run: echo "${VERSION}" > version.txt
52+
env:
53+
VERSION: ${{ steps.process_version.outputs.version }}
5454

5555
- name: Check if changes exist
5656
id: check_changes

0 commit comments

Comments
 (0)