Skip to content

Commit aa1eef6

Browse files
committed
Refactor: Streamline GitHub Actions workflow
This commit refactors the Android GitHub Actions workflow for improved efficiency and clarity. Key changes include: - **Removed Container for Setup Job:** The `setup` job no longer runs in a Docker container, simplifying the environment. - **Simplified Ruby & Bundler Setup:** - Updated Ruby version from 3.2 to 3.1. - Leveraged `bundler-cache: true` in `ruby/setup-ruby` action for faster dependency installation. - Removed explicit `bundle-path` output and its usage in subsequent steps. - Simplified Bundler installation commands. - **Direct Secret Usage:** Keystore and key passwords are now directly accessed from secrets within the `local.properties` creation step, removing the need for environment variables for these secrets. - **Removed Redundant PATH Environment Variable:** The explicit setting of `PATH` environment variable in deployment and build jobs has been removed as Bundler now handles the execution path. - **Improved Step Naming:** Renamed some steps for better clarity (e.g., "Build with Fastlane" instead of "Run buildBundle lane").
1 parent 9be40c3 commit aa1eef6

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

.github/workflows/android.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,12 @@ on:
1010

1111
env:
1212
KEYSTORE_FILE: keystore-qrbarcode.jks
13-
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
14-
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
15-
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
1613
GOOGLE_PLAY_JSON_PATH: app/qrbarcode-8b0b8-aaefa03b2374.json
1714

1815
jobs:
1916
setup:
2017
name: Setup Environment
2118
runs-on: ubuntu-latest
22-
container:
23-
image: softartdev/android-fastlane:33
24-
outputs:
25-
bundle-path: ${{ steps.set-bundle-path.outputs.bundle-path }}
2619

2720
steps:
2821
- name: Checkout Repository
@@ -40,25 +33,19 @@ jobs:
4033
- name: Setup Ruby
4134
uses: ruby/setup-ruby@v1
4235
with:
43-
ruby-version: '3.2'
44-
45-
- name: Set Bundle Path Output
46-
id: set-bundle-path
47-
run: echo "bundle-path=${HOME}/.gem/ruby/3.2.0/bin" >> $GITHUB_OUTPUT
36+
ruby-version: '3.1'
37+
bundler-cache: true
4838

4939
- name: Cache Ruby Gems
5040
uses: actions/cache@v4
5141
with:
5242
path: vendor/bundle
5343
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
5444

55-
- name: Install Bundler & Fastlane
45+
- name: Install Fastlane via Bundler
5646
run: |
57-
gem install bundler:2.5.11 --user-install
58-
bundle _2.5.11_ config set path vendor/bundle
59-
bundle _2.5.11_ install
60-
env:
61-
PATH: "${{ steps.set-bundle-path.outputs.bundle-path }}:${PATH}"
47+
bundle config set path 'vendor/bundle'
48+
bundle install
6249
6350
- name: Decode Keystore File
6451
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > $KEYSTORE_FILE
@@ -67,9 +54,9 @@ jobs:
6754
run: |
6855
echo "sdk.dir=$ANDROID_HOME" > local.properties
6956
echo "KEYSTORE_FILE=$KEYSTORE_FILE" >> local.properties
70-
echo "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> local.properties
71-
echo "KEY_ALIAS=$KEY_ALIAS" >> local.properties
72-
echo "KEY_PASSWORD=$KEY_PASSWORD" >> local.properties
57+
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> local.properties
58+
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> local.properties
59+
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> local.properties
7360
7461
- name: Create Google Service Account JSON
7562
run: |
@@ -83,11 +70,8 @@ jobs:
8370

8471
steps:
8572
- uses: actions/checkout@v3
86-
87-
- name: Run buildBundle lane
73+
- name: Build with Fastlane
8874
run: bundle exec fastlane buildBundle
89-
env:
90-
PATH: "${{ needs.setup.outputs.bundle-path }}:${PATH}"
9175

9276
- name: Upload Bundle Artifact
9377
uses: actions/upload-artifact@v4
@@ -104,8 +88,6 @@ jobs:
10488
- uses: actions/checkout@v3
10589
- name: Run Tests
10690
run: bundle exec fastlane test
107-
env:
108-
PATH: "${{ needs.setup.outputs.bundle-path }}:${PATH}"
10991

11092
code-analysis:
11193
name: Lint & Check
@@ -132,10 +114,8 @@ jobs:
132114

133115
steps:
134116
- uses: actions/checkout@v3
135-
- name: Deploy
117+
- name: Deploy Release
136118
run: bundle exec fastlane deployRelease
137-
env:
138-
PATH: "${{ needs.setup.outputs.bundle-path }}:${PATH}"
139119

140120
deploy-beta:
141121
name: Deploy to Play Store (Beta)
@@ -145,10 +125,8 @@ jobs:
145125

146126
steps:
147127
- uses: actions/checkout@v3
148-
- name: Deploy
128+
- name: Deploy Beta
149129
run: bundle exec fastlane deployBeta
150-
env:
151-
PATH: "${{ needs.setup.outputs.bundle-path }}:${PATH}"
152130

153131
deploy-firebase-internal:
154132
name: Distribute via Firebase (Internal)
@@ -158,7 +136,5 @@ jobs:
158136

159137
steps:
160138
- uses: actions/checkout@v3
161-
- name: Deploy
139+
- name: Deploy Firebase Internal
162140
run: bundle exec fastlane deployFirebase --verbose
163-
env:
164-
PATH: "${{ needs.setup.outputs.bundle-path }}:${PATH}"

0 commit comments

Comments
 (0)