Skip to content

Commit 39740e6

Browse files
committed
ci fix
1 parent e759943 commit 39740e6

5 files changed

Lines changed: 99 additions & 32 deletions

File tree

.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/setup-ruby@v1.152.0
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/setup-ruby@v1.152.0
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/cache@v3.0.2
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

0 commit comments

Comments
 (0)