mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-20 03:03:44 +08:00
Extract version number from source code
This commit is contained in:
parent
d6a3de0558
commit
91e0696bc5
15
.github/workflows/pkg-DEB.yml
vendored
15
.github/workflows/pkg-DEB.yml
vendored
@ -6,7 +6,7 @@
|
|||||||
# Created On : <2025-06-10>
|
# Created On : <2025-06-10>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-06-16>
|
||||||
#
|
#
|
||||||
# This workflow build and publish DEB packages
|
# Build and publish DEB packages
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
name: Build and Publish DEB package
|
name: Build and Publish DEB package
|
||||||
@ -30,18 +30,25 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: gh-build
|
||||||
|
|
||||||
- name: Get version from tag or input
|
- name: 获取版本号 from tag or input
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "release" ]; then
|
if [ "${{ github.event_name }}" = "release" ]; then
|
||||||
version="${{ github.event.release.tag_name }}"
|
version="${{ github.event.release.tag_name }}"
|
||||||
version=${version#v} # Remove 'v' prefix if present
|
# 删除前缀 'v' if present
|
||||||
|
version=${version#v}
|
||||||
|
|
||||||
elif [ "${{ github.event_name }}" = "push" ];then
|
elif [ "${{ github.event_name }}" = "push" ];then
|
||||||
version="9.9.9" # Default version for push events (temporarily)
|
# 从源代码中提取版本号
|
||||||
|
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/chsrc-main.c)
|
||||||
|
|
||||||
else
|
else
|
||||||
version="${{ github.event.inputs.version }}"
|
version="${{ github.event.inputs.version }}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "version=$version" >> $GITHUB_OUTPUT
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
echo "Version: $version"
|
echo "Version: $version"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user