File tree Expand file tree Collapse file tree 5 files changed +66
-13
lines changed
Expand file tree Collapse file tree 5 files changed +66
-13
lines changed Original file line number Diff line number Diff line change 1+ name : Auto Version Bump
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths-ignore :
8+ - ' gradle.properties'
9+ - ' .github/workflows/**'
10+
11+ jobs :
12+ bump-version :
13+ runs-on : ubuntu-latest
14+ if : " !contains(github.event.head_commit.message, '[skip ci]')"
15+ steps :
16+ - name : Checkout Code
17+ uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+ token : ${{ secrets.GITHUB_TOKEN }}
21+
22+ - name : Get Current Version
23+ id : get_version
24+ run : |
25+ VERSION=$(grep 'appVersionName=' gradle.properties | cut -d'=' -f2)
26+ echo "current_version=$VERSION" >> $GITHUB_OUTPUT
27+
28+ - name : Determine Bump Type
29+ id : bump_type
30+ uses : anothrNick/github-tag-action@1.67.0
31+ env :
32+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
33+ WITH_V : false
34+ DRY_RUN : true
35+ DEFAULT_BUMP : patch
36+
37+ - name : Bump Version in Files
38+ id : bump
39+ run : |
40+ BUMP_TYPE="${{ steps.bump_type.outputs.part }}"
41+ if [ -z "$BUMP_TYPE" ]; then BUMP_TYPE="patch"; fi
42+ NEW_VERSION=$(python3 scripts/bump_version.py ${{ steps.get_version.outputs.current_version }} $BUMP_TYPE)
43+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
44+
45+ - name : Commit and Push Changes
46+ run : |
47+ NEW_TAG="v${{ steps.bump.outputs.new_version }}"
48+ git config --local user.email "action@github.com"
49+ git config --local user.name "GitHub Action"
50+ git add gradle.properties
51+ git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }} [skip ci]"
52+ git tag $NEW_TAG
53+ git push origin main
54+ git push origin $NEW_TAG
Original file line number Diff line number Diff line change 1- name : Build Lissen App
1+ name : Build Kahani App
22
33env :
44 # The name of the main module repository
55 main_project_module : app
66
77on :
88 push :
9- branches : [ " main" ]
9+ branches : [' main' ]
1010 pull_request :
11- branches : [ " main" ]
11+ branches : [' main' ]
1212
1313 workflow_dispatch :
1414
1515jobs :
1616 build :
17-
1817 runs-on : ubuntu-latest
1918
2019 steps :
Original file line number Diff line number Diff line change @@ -2,11 +2,8 @@ name: Build and Release Kahani
22
33on :
44 push :
5- branches :
6- - main
7- pull_request :
8- branches :
9- - main
5+ tags :
6+ - ' v*'
107 workflow_dispatch :
118
129jobs :
4239 uses : softprops/action-gh-release@v1
4340 with :
4441 files : app/build/outputs/apk/release/app-release.apk
45- tag_name : v ${{ github.run_number }}
46- name : Release v ${{ github.run_number }}
42+ tag_name : ${{ github.ref_name }}
43+ name : Release ${{ github.ref_name }}
4744 body : |
4845 Automated Release for Kahani.
4946 Commit: ${{ github.sha }}
Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ android {
5353 applicationId = " org.surjit.kahani"
5454 minSdk = 28
5555 targetSdk = 36
56- versionCode = 10000
57- versionName = " 1.0.0- ${commitHash} "
56+ versionCode = project.property( " appVersionCode " ).toString().toInt()
57+ versionName = project.property( " appVersionName " ).toString()
5858
5959 buildConfigField(" String" , " GIT_HASH" , " \" $commitHash \" " )
6060
Original file line number Diff line number Diff line change @@ -2,3 +2,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
22android.useAndroidX =true
33kotlin.code.style =official
44android.nonTransitiveRClass =true
5+
6+ appVersionName =1.0.0
7+ appVersionCode =10000
You can’t perform that action at this time.
0 commit comments