Skip to content

Commit 0c00070

Browse files
committed
Fix building release version
1 parent 889257a commit 0c00070

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/build.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ jobs:
1818
id: version
1919
shell: bash
2020
run: |
21-
today="$(date --utc '+%Y-%m-%d')"
22-
midnight_timestamp="$(date --utc +%s --date=$today)"
23-
calver_date="$(date --utc --date=$today '+%Y.%-m.dev%d')"
24-
commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)"
25-
commit_count="$(printf "%02d" ${commit_count})"
26-
version="${calver_date}${commit_count}"
21+
version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}')
22+
if [[ ! -z "${{ github.event.inputs.version }}" ]]; then
23+
version="${{ github.event.inputs.version }}"
24+
elif [[ "${version}" =~ (main|dev) ]]; then
25+
today="$(date --utc '+%Y-%m-%d')"
26+
midnight_timestamp="$(date --utc +%s --date=$today)"
27+
calver_date="$(date --utc --date=$today '+%Y.%-m.dev%d')"
28+
commit_count="$(git rev-list --count --since=$midnight_timestamp HEAD)"
29+
commit_count="$(printf "%02d" ${commit_count})"
30+
version="${calver_date}${commit_count}"
31+
fi
2732
echo "version=$version" >> "$GITHUB_OUTPUT"
2833
- name: Find-and-replace strings
2934
id: python-version

0 commit comments

Comments
 (0)