ci: Update version setup action to support desktop and mobile app versioning

- Add input parameter to specify app type (desktop or mobile)
- Modify version extraction logic to use correct package.json based on app type
- Update build workflow to explicitly set app type when setting up version

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-03-04 15:32:32 +08:00
parent 6c6bb9b401
commit e5e9e8dfde
2 changed files with 12 additions and 1 deletions
+10 -1
View File
@@ -1,5 +1,10 @@
name: Setup Version
description: "Setup Version"
inputs:
type:
required: true
description: "Type of the app, either 'desktop' or 'mobile'"
default: "desktop"
outputs:
APP_VERSION:
description: "App Version"
@@ -14,7 +19,11 @@ runs:
if [ "${{ github.ref_type }}" == "tag" ]; then
APP_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
else
APP_VERSION=$(node -p "require('./package.json').version")
if [ "${{ inputs.type }}" == "desktop" ]; then
APP_VERSION=$(node -p "require('./apps/desktop/package.json').version")
else
APP_VERSION=$(node -p "require('./apps/mobile/package.json').version")
fi
fi
echo $APP_VERSION
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT"
+2
View File
@@ -223,6 +223,8 @@ jobs:
- name: Setup Version
id: version
uses: ./.github/actions/setup-version
with:
type: "desktop"
- name: Create Release Draft
if: github.ref_type == 'tag' || github.event.inputs.tag_version == 'true'