From e5e9e8dfde1e6dc22fedca26ce6be55d0e9f996a Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 4 Mar 2025 15:32:32 +0800 Subject: [PATCH] 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 --- .github/actions/setup-version/action.yml | 11 ++++++++++- .github/workflows/build.yml | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-version/action.yml b/.github/actions/setup-version/action.yml index 96e9066ff..a9b040ec1 100644 --- a/.github/actions/setup-version/action.yml +++ b/.github/actions/setup-version/action.yml @@ -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" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 637393419..a4ddaa905 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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'