Skip to content

Commit d2df92a

Browse files
authored
Merge pull request #59 from stslex/dev
Dev
2 parents 5f3a998 + 39740e6 commit d2df92a

File tree

37 files changed

+550
-257
lines changed

37 files changed

+550
-257
lines changed

.github/scripts/update_versions.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Define the initial script directory
4+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
project_dir="$(dirname "$script_dir")"
6+
project_dir="$(dirname "$project_dir")"
7+
echo "Project script directory: $project_dir"
8+
9+
# Define the path to the target file
10+
version_file="$project_dir/gradle/libs.versions.toml"
11+
12+
# Check if the target file exists
13+
if [ -f "$version_file" ]; then
14+
echo "Target file found: $version_file"
15+
else
16+
echo "Target file not found"
17+
exit 1 # Exit the script if the target file is not found
18+
fi
19+
20+
# Read versionName and versionCode from the file
21+
version_name=$(awk -F '"' '/versionName = "/{print $2}' "$version_file")
22+
version_code=$(awk -F '"' '/versionCode = "/{print $2}' "$version_file")
23+
24+
# Increment versionCode by 1
25+
((version_code++))
26+
27+
# Increment versionName by 0.01
28+
version_name=$(echo "$version_name + 0.01" | bc)
29+
30+
# Update the file with the new version information
31+
sed "s/versionName = \".*\"/versionName = \"$version_name\"/" "$version_file" > "$version_file.tmp"
32+
mv "$version_file.tmp" "$version_file"
33+
34+
sed "s/versionCode = \".*\"/versionCode = \"$version_code\"/" "$version_file" > "$version_file.tmp"
35+
mv "$version_file.tmp" "$version_file"
36+
37+
echo "Updated versionName to $version_name and versionCode to $version_code in $version_file"
38+

.github/workflows/android_deploy_beta.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ jobs:
1010
timeout-minutes: 60
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
- run: |
1616
echo "${{ secrets.KEYSTORE }}" > keystore.jks.asc
1717
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.jks.asc > keystore.jks
1818
19-
- uses: ruby/[email protected]
19+
- name: Update Version
20+
run: bash ./.github/scripts/update_versions.sh
21+
22+
- uses: ruby/setup-ruby@v1
2023
with:
21-
ruby-version: '2.7.0'
24+
ruby-version: '3.3'
2225

2326
- name: Cache Ruby - Bundler
2427
uses: actions/cache@v2
@@ -74,4 +77,16 @@ jobs:
7477
base64 -d -i play_config.json.b64 > play_config.json
7578
7679
- name: Distribute app to Beta track 🚀
77-
run: bundle exec fastlane beta
80+
run: bundle exec fastlane beta
81+
82+
- name: Commit files
83+
run: |
84+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
85+
git config --local user.name "github-actions[bot]"
86+
git commit -a -m "update version"
87+
88+
- name: Push changes
89+
uses: ad-m/github-push-action@master
90+
with:
91+
github_token: ${{ secrets.PUSH_TOKEN }}
92+
branch: ${{ github.ref }}

.github/workflows/android_deploy_prod.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ jobs:
1010
timeout-minutes: 60
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
- run: |
1616
echo "${{ secrets.KEYSTORE }}" > keystore.jks.asc
1717
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.jks.asc > keystore.jks
1818
19-
- uses: ruby/[email protected]
19+
- name: Update Version
20+
run: bash ./.github/scripts/update_versions.sh
21+
22+
- uses: ruby/setup-ruby@v1
2023
with:
21-
ruby-version: '2.7.0'
24+
ruby-version: '3.3'
2225

2326
- name: Cache Ruby - Bundler
2427
uses: actions/cache@v2
@@ -74,4 +77,16 @@ jobs:
7477
base64 -d -i play_config.json.b64 > play_config.json
7578
7679
- name: Distribute app to Beta track 🚀
77-
run: bundle exec fastlane deploy
80+
run: bundle exec fastlane deploy
81+
82+
- name: Commit files
83+
run: |
84+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
85+
git config --local user.name "github-actions[bot]"
86+
git commit -a -m "update version"
87+
88+
- name: Push changes
89+
uses: ad-m/github-push-action@master
90+
with:
91+
github_token: ${{ secrets.PUSH_TOKEN }}
92+
branch: ${{ github.ref }}

.github/workflows/android_jobs.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,17 @@ jobs:
1111

1212
steps:
1313
- name: Checkout branch
14-
uses: actions/checkout@v3
15-
14+
uses: actions/checkout@v4
1615
- run: |
1716
echo "${{ secrets.KEYSTORE }}" > keystore.jks.asc
1817
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.jks.asc > keystore.jks
1918
20-
- name: Set up JDK 17
19+
- name: set up JDK 17
2120
uses: actions/setup-java@v3
2221
with:
22+
java-version: '17'
2323
distribution: 'temurin'
24-
java-version: 17
25-
26-
- name: Grant execute permission for gradlew
27-
run: chmod +x gradlew
28-
29-
- name: Gradle Wrapper Validation
30-
uses: gradle/wrapper-validation-action@v1
31-
32-
- name: Cache Gradle
33-
uses: actions/[email protected]
34-
with:
35-
path: |
36-
~/.gradle/caches
37-
~/.gradle/wrapper
38-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
39-
restore-keys: |
40-
${{ runner.os }}-gradle-.
24+
cache: gradle
4125

4226
- name: Configure Keystore
4327
env:
@@ -50,10 +34,25 @@ jobs:
5034
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> keystore.properties
5135
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> keystore.properties
5236
53-
- name: Build application
54-
run: ./gradlew build --full-stacktrace
37+
- name: Cache Gradle
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.gradle/caches/
41+
key: cache-clean-gradle-${{ matrix.os }}-${{ matrix.jdk }}
42+
43+
- name: Cache Gradle Wrapper
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.gradle/wrapper/
47+
key: cache-clean-wrapper-${{ matrix.os }}-${{ matrix.jdk }}
48+
49+
- name: Grant execute permission for gradlew
50+
run: chmod +x gradlew
51+
52+
- name: Build with Gradle
53+
run: ./gradlew build --full-stacktrace
5554

56-
- name: Test
55+
- name: Junit tests with Gradle
5756
run: ./gradlew testDebugUnitTest --full-stacktrace
5857

5958
- name: Publish Test Results

.github/workflows/testReportJob.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout branch
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- run: |
1818
echo "${{ secrets.KEYSTORE }}" > keystore.jks.asc

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
*.iml
22
.gradle
3+
.idea
4+
.kotlin
35
/local.properties
4-
/.idea
56
.DS_Store
67
/build
78
/captures
89
.externalNativeBuild
910
.cxx
1011
local.properties
11-
keystore.*
1212
play_config.*
13+
keystore.*
14+
Gemfile.lock
15+
build

app/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ dependencies {
1313
implementation(project(":feature:edit"))
1414
implementation(project(":feature:edit-label"))
1515
}
16-
17-
android.namespace = "com.stslex93.notes"

build-logic/dependencies/build.gradle.kts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ plugins {
55
group = "com.stslex93.notes.buildlogic"
66

77
dependencies {
8-
implementation(libs.android.gradlePlugin)
9-
implementation(libs.kotlin.gradlePlugin)
10-
implementation(libs.kotlin.serialization)
8+
compileOnly(libs.android.gradlePlugin)
9+
compileOnly(libs.kotlin.gradlePlugin)
10+
compileOnly(libs.kotlin.serialization)
11+
compileOnly(libs.composeCompiler.gradlePlugin)
12+
compileOnly(libs.android.tools.common)
13+
}
14+
15+
tasks {
16+
validatePlugins {
17+
enableStricterValidation = true
18+
failOnWarning = true
19+
}
1120
}
1221

1322
gradlePlugin {

build-logic/dependencies/src/main/kotlin/AndroidApplicationComposePlugin.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import AppExt.findPluginId
2+
import AppExt.libs
13
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
24
import com.stslex93.notes.configureAndroidCompose
35
import org.gradle.api.Plugin
@@ -8,6 +10,8 @@ class AndroidApplicationComposePlugin : Plugin<Project> {
810
override fun apply(target: Project) {
911
with(target) {
1012
pluginManager.apply("com.android.application")
13+
pluginManager.apply(libs.findPluginId("kotlin"))
14+
pluginManager.apply(libs.findPluginId("composeCompiler"))
1115
val extension = extensions.getByType<BaseAppModuleExtension>()
1216
configureAndroidCompose(extension)
1317
}

build-logic/dependencies/src/main/kotlin/AndroidApplicationPlugin.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import AppExt.APP_PREFIX
2+
import AppExt.findVersionInt
3+
import AppExt.findVersionString
4+
import AppExt.libs
15
import com.android.build.api.dsl.ApplicationExtension
26
import com.stslex93.notes.configureKotlinAndroid
37
import org.gradle.api.Plugin
@@ -20,13 +24,13 @@ class AndroidApplicationPlugin : Plugin<Project> {
2024
extensions.configure<ApplicationExtension> {
2125
configureKotlinAndroid(this)
2226

23-
namespace = "com.stslex93.notes"
27+
namespace = APP_PREFIX
2428

2529
defaultConfig.apply {
26-
applicationId = "com.stslex93.notes"
27-
targetSdk = 34
28-
versionCode = AppVersion.VERSION_CODE
29-
versionName = AppVersion.VERSION_NAME
30+
applicationId = APP_PREFIX
31+
targetSdk = libs.findVersionInt("targetSdk")
32+
versionName = libs.findVersionString("versionName")
33+
versionCode = libs.findVersionInt("versionCode")
3034

3135
signingConfigs {
3236
val keystoreProperties =

0 commit comments

Comments
 (0)