Skip to content

Commit 5c60708

Browse files
committed
Refactor: update GitHub Actions workflow
This commit updates the Android CI workflow in `.github/workflows/android.yml`. Key changes include: - Updating `KEYSTORE_FILE` environment variable path. - Restructuring and streamlining the `build` job: - Moved JDK and Ruby setup steps. - Simplified keystore decoding and `local.properties` creation. - Added Google Service Account JSON creation. - Minor refactoring in `test`, `code-analysis`, `deploy-production`, `deploy-development`, and `deploy-internal-testing` jobs for consistency.
1 parent 63aacac commit 5c60708

1 file changed

Lines changed: 51 additions & 32 deletions

File tree

.github/workflows/android.yml

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch:
1010

1111
env:
12-
KEYSTORE_FILE: keystore-qrbarcode.jks
12+
KEYSTORE_FILE: app/keystore-qrbarcode.jks
1313
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
1414
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
1515
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
@@ -45,35 +45,13 @@ jobs:
4545
path: vendor/bundle
4646
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
4747

48-
- name: Install Dependencies
48+
- name: Install Ruby Dependencies
4949
run: |
5050
bundle config set path 'vendor/bundle'
5151
bundle install
5252
53-
# - name: Setup before script
54-
# run: |
55-
# chmod +x ./gradlew
56-
# chmod +x ./scripts/before-ci.sh
57-
# touch local.properties
58-
# ./scripts/before-ci.sh
59-
# echo "sdk.dir=$ANDROID_HOME" >> local.properties
60-
6153
- name: Decode Keystore File
62-
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > "${{ env.KEYSTORE_FILE }}"
63-
64-
- name: Debug keystore file
65-
run: ls -la app
66-
67-
- name: Write local.properties
68-
run: |
69-
echo "sdk.dir=$ANDROID_HOME" > local.properties
70-
echo "KEYSTORE_FILE=${{ env.KEYSTORE_FILE }}" >> local.properties
71-
echo "KEYSTORE_PASSWORD=${{ env.KEYSTORE_PASSWORD }}" >> local.properties
72-
echo "KEY_ALIAS=${{ env.KEY_ALIAS }}" >> local.properties
73-
echo "KEY_PASSWORD=${{ env.KEY_PASSWORD }}" >> local.properties
74-
75-
- name: Debug local.properties
76-
run: cat local.properties
54+
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > ${{ env.KEYSTORE_FILE }}
7755

7856
- name: Create Google Service Account JSON
7957
run: |
@@ -84,26 +62,55 @@ jobs:
8462
name: Build AAB
8563
runs-on: ubuntu-latest
8664
needs: setup
65+
8766
steps:
8867
- uses: actions/checkout@v3
89-
- name: Grant execute permission for gradlew
90-
run: chmod +x ./gradlew
91-
- uses: actions/setup-java@v3
68+
69+
- name: Setup JDK 17
70+
uses: actions/setup-java@v3
9271
with:
9372
java-version: '17'
9473
distribution: 'temurin'
95-
- uses: ruby/setup-ruby@v1
74+
75+
- name: Setup Ruby
76+
uses: ruby/setup-ruby@v1
9677
with:
9778
ruby-version: '3.1'
9879
bundler-cache: true
99-
- uses: actions/cache@v4
80+
81+
- name: Cache Ruby Gems
82+
uses: actions/cache@v4
10083
with:
10184
path: vendor/bundle
10285
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
103-
- run: |
86+
87+
- name: Install Ruby Dependencies
88+
run: |
10489
bundle config set path 'vendor/bundle'
10590
bundle install
106-
- run: bundle exec fastlane buildBundle
91+
92+
- name: Decode Keystore File
93+
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > ${{ env.KEYSTORE_FILE }}
94+
95+
- name: Write local.properties
96+
run: |
97+
echo "sdk.dir=$ANDROID_HOME" > local.properties
98+
echo "KEYSTORE_FILE=${{ env.KEYSTORE_FILE }}" >> local.properties
99+
echo "KEYSTORE_PASSWORD=${{ env.KEYSTORE_PASSWORD }}" >> local.properties
100+
echo "KEY_ALIAS=${{ env.KEY_ALIAS }}" >> local.properties
101+
echo "KEY_PASSWORD=${{ env.KEY_PASSWORD }}" >> local.properties
102+
103+
- name: Create Google Service Account JSON
104+
run: |
105+
mkdir -p app
106+
echo "${{ secrets.GOOGLE_PLAY_JSON }}" | base64 --decode > ${{ env.GOOGLE_PLAY_JSON_PATH }}
107+
108+
- name: Grant execute permission for gradlew
109+
run: chmod +x ./gradlew
110+
111+
- name: Build AAB via Fastlane
112+
run: bundle exec fastlane buildBundle
113+
107114
- uses: actions/upload-artifact@v4
108115
with:
109116
name: release-aab
@@ -113,32 +120,41 @@ jobs:
113120
name: Unit Tests
114121
runs-on: ubuntu-latest
115122
needs: build
123+
116124
steps:
117125
- uses: actions/checkout@v3
126+
118127
- uses: ruby/setup-ruby@v1
119128
with:
120129
ruby-version: '3.1'
121130
bundler-cache: true
131+
122132
- uses: actions/cache@v4
123133
with:
124134
path: vendor/bundle
125135
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
136+
126137
- run: |
127138
bundle config set path 'vendor/bundle'
128139
bundle install
140+
129141
- run: bundle exec fastlane test
130142

131143
code-analysis:
132144
name: Lint & Check
133145
runs-on: ubuntu-latest
134146
needs: build
147+
135148
steps:
136149
- uses: actions/checkout@v3
150+
137151
- uses: actions/setup-java@v3
138152
with:
139153
java-version: '17'
140154
distribution: 'temurin'
155+
141156
- run: ./gradlew clean check
157+
142158
- uses: actions/upload-artifact@v4
143159
with:
144160
name: lint-reports
@@ -152,6 +168,7 @@ jobs:
152168
runs-on: ubuntu-latest
153169
if: github.ref == 'refs/heads/master'
154170
needs: build
171+
155172
steps:
156173
- uses: actions/checkout@v3
157174
- uses: ruby/setup-ruby@v1
@@ -172,6 +189,7 @@ jobs:
172189
runs-on: ubuntu-latest
173190
if: github.ref == 'refs/heads/development'
174191
needs: build
192+
175193
steps:
176194
- uses: actions/checkout@v3
177195
- uses: ruby/setup-ruby@v1
@@ -192,6 +210,7 @@ jobs:
192210
runs-on: ubuntu-latest
193211
if: startsWith(github.ref, 'refs/heads/internal-testing/')
194212
needs: build
213+
195214
steps:
196215
- uses: actions/checkout@v3
197216
- uses: ruby/setup-ruby@v1

0 commit comments

Comments
 (0)