Skip to content

Commit 91e0696

Browse files
committed
Extract version number from source code
1 parent d6a3de0 commit 91e0696

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/pkg-DEB.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Created On : <2025-06-10>
77
# Last Modified : <2025-06-16>
88
#
9-
# This workflow build and publish DEB packages
9+
# Build and publish DEB packages
1010
# ---------------------------------------------------------------
1111

1212
name: Build and Publish DEB package
@@ -30,18 +30,25 @@ jobs:
3030
steps:
3131
- name: Checkout repo
3232
uses: actions/checkout@v4
33+
with:
34+
ref: gh-build
3335

34-
- name: Get version from tag or input
36+
- name: 获取版本号 from tag or input
3537
id: get_version
3638
run: |
3739
if [ "${{ github.event_name }}" = "release" ]; then
3840
version="${{ github.event.release.tag_name }}"
39-
version=${version#v} # Remove 'v' prefix if present
41+
# 删除前缀 'v' if present
42+
version=${version#v}
43+
4044
elif [ "${{ github.event_name }}" = "push" ];then
41-
version="9.9.9" # Default version for push events (temporarily)
45+
# 从源代码中提取版本号
46+
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/chsrc-main.c)
47+
4248
else
4349
version="${{ github.event.inputs.version }}"
4450
fi
51+
4552
echo "version=$version" >> $GITHUB_OUTPUT
4653
echo "Version: $version"
4754

0 commit comments

Comments
 (0)