Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release Version

on:
push:
branches:
- release

jobs:
bump-and-tag:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Bump Version
run: |
FILE=version.properties

source $FILE

NEW_CODE=$((VERSION_CODE + 1))

IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NAME"
NEW_PATCH=$((PATCH + 1))
NEW_NAME="$MAJOR.$MINOR.$NEW_PATCH"

echo "VERSION_CODE=$NEW_CODE" > $FILE
echo "VERSION_NAME=$NEW_NAME" >> $FILE

echo "New Version: $NEW_NAME ($NEW_CODE)"

- name: Commit changes
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add version.properties
git commit -m "Release: bump version"
git push

- name: Create Git Tag
run: |
source version.properties
git tag "v$VERSION_NAME"
git push origin "v$VERSION_NAME"
8 changes: 6 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ android {
namespace = "com.byteutility.dev.leetcode.plus"
compileSdk = 35

val versionPropsFile = rootProject.file("version.properties")
val versionProps = Properties()
versionProps.load(FileInputStream(versionPropsFile))

// Load local properties
val localPropertiesFile = rootProject.file("local.properties")
val localProperties = Properties()
Expand All @@ -34,8 +38,8 @@ android {
applicationId = "com.byteutility.dev.leetcode.plus"
minSdk = 29
targetSdk = 35
versionCode = 15
versionName = "1.1.4"
versionCode = versionProps["VERSION_CODE"].toString().toInt()
versionName = versionProps["VERSION_NAME"].toString()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 2 additions & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VERSION_CODE=15
VERSION_NAME=1.1.4