mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2025-02-21 09:13:16 +03:00
chore: Fix bump project version
This commit is contained in:
parent
65b54a9779
commit
0d91c3429b
23
.github/workflows/build-release.yaml
vendored
23
.github/workflows/build-release.yaml
vendored
@ -7,13 +7,15 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
auto-bump-version:
|
||||
description: 'Bump project version before building release'
|
||||
description: 'Auto bump project version before building release'
|
||||
required: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
BuildRelease:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
Greeting: Hello
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
@ -43,8 +45,8 @@ jobs:
|
||||
|
||||
- name: Auto bump project version
|
||||
if: ${{ inputs.auto-bump-version }}
|
||||
id: bump-version
|
||||
run: |
|
||||
# Update versionName and versionCode in build.gradle.kts
|
||||
versionCode=$(grep -oP 'versionCode = \K\d+' build.gradle.kts)
|
||||
versionName=$(grep -oP 'versionName = "\K[0-9.]+' build.gradle.kts)
|
||||
major=$(echo $versionName | cut -d. -f1)
|
||||
@ -55,7 +57,14 @@ jobs:
|
||||
newVersionCode=$((versionCode + 1))
|
||||
sed -i "s/versionCode = $versionCode/versionCode = $newVersionCode/" build.gradle.kts
|
||||
sed -i "s/versionName = \"$versionName\"/versionName = \"$newVersionName\"/" build.gradle.kts
|
||||
# Commit, tag and push
|
||||
echo "::set-output name=newVersionName::$newVersionName"
|
||||
echo "::set-output name=newVersionCode::$newVersionCode"
|
||||
|
||||
- name: Commit modified version code and make new tag
|
||||
if: ${{ inputs.auto-bump-version }}
|
||||
run: |
|
||||
newVersionName=${{ steps.bump-version.outputs.newVersionName }}
|
||||
newVersionCode=${{ steps.bump-version.outputs.newVersionCode }}
|
||||
git commit -am "Bump version to $newVersionName ($newVersionCode)"
|
||||
git tag "v$newVersionName"
|
||||
git push --follow-tags
|
||||
@ -80,15 +89,11 @@ jobs:
|
||||
with:
|
||||
arguments: --no-daemon app:assembleMetaRelease
|
||||
|
||||
- name: Set current tag
|
||||
id: current_tag
|
||||
run: echo ::set-output name=tag::$(git describe --tags --abbrev=0)
|
||||
|
||||
- name: Tag Repo
|
||||
uses: richardsimko/update-tag@v1
|
||||
with:
|
||||
tag: ${{ steps.current_tag.outputs.tag }}
|
||||
tag_name: ${{ steps.current_tag.outputs.tag }}
|
||||
tag: v${{ steps.bump-version.outputs.newVersionName }}
|
||||
tag_name: v${{ steps.bump-version.outputs.newVersionName }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user