Skip to content

Commit 4aed7f7

Browse files
authored
Fastlane CD (init) (#117)
1 parent 3398b4e commit 4aed7f7

34 files changed

+524
-1
lines changed

.fvmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"flutter": "3.7.12",
3+
"flavors": {}
4+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: 🚀🤖 Bundle and deploy Sweyer to Google Play
2+
description: Bundles and deploys Sweyer to Google Play
3+
4+
inputs:
5+
flutter_channel:
6+
required: false
7+
default: "stable"
8+
description: The channel of the Flutter used to build Sweyer with.
9+
flutter_version:
10+
required: false
11+
default: "3.7.12"
12+
description: The version of Flutter used to build Sweyer with.
13+
testing_arguments:
14+
required: false
15+
default: ""
16+
description: Optional additional arguments to the flutter test command.\\
17+
ruby_version:
18+
required: false
19+
default: 3.3.0
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: 🐦 Setup Flutter
25+
uses: subosito/flutter-action@v2
26+
with:
27+
flutter-version: ${{inputs.flutter_version}}
28+
channel: ${{inputs.flutter_channel}}
29+
cache: true
30+
31+
- name: 💎 Set up ruby env
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: ${{inputs.ruby_version}}
35+
bundler-cache: true
36+
37+
- name: ⚙️ Decode Keystore File
38+
uses: timheuer/base64-to-file@v1
39+
id: android_keystore
40+
with:
41+
fileName: "keystore.jks"
42+
encodedString: ${{ secrets.ANDROID_KEYSTORE_FILE }}
43+
44+
- name: Generate keystore.properties
45+
run: |
46+
cat <<EOF > keystore.properties
47+
storePassword:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
48+
keyPassword:${{ secrets.ANDROID_KEY_PASSWORD }}
49+
keyAlias:${{ secrets.ANDROID_KEY_ALIAS }}
50+
storeFile:${{ steps.android_keystore.outputs.filePath }}
51+
EOF
52+
53+
- name: 📖 Read app version
54+
uses: NiklasLehnfeld/flutter-version-number-action@main
55+
id: read-version
56+
with:
57+
file-path: pubspec.yaml
58+
59+
- name: 🪓 Split app version
60+
uses: winterjung/split@v2
61+
id: splitted-version
62+
with:
63+
msg: ${{ steps.read-version.outputs.version-number }}
64+
separator: '+'
65+
66+
- name: 🏗️ Build AAB
67+
run: |
68+
tools/build_android_bundle.sh
69+
70+
- name: ✍ Rename APK
71+
run: |
72+
mv ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab ${{ github.workspace }}/build/app/outputs/bundle/release/sweyer@${{ steps.read-version.outputs.version-number }}.aab
73+
74+
- name: 🏗️ Build APK
75+
run: |
76+
tools/build_android_apk.sh
77+
78+
- name: ✍ Rename APK
79+
run: |
80+
mv ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.apk ${{ github.workspace }}/build/app/outputs/bundle/release/sweyer@${{ steps.read-version.outputs.version-number }}.apk
81+
82+
- name: ⚙️ Decode Service Account Key JSON File
83+
uses: timheuer/base64-to-file@v1
84+
id: android_service_account_json_file
85+
with:
86+
fileName: "androidServiceAccount.json"
87+
encodedString: ${{ secrets.GPLAY_FASTLANE_SERVICE_ACCOUNT_KEY_JSON }}
88+
89+
- name: 🚀🤖 Build & deploy Android release
90+
run: bundle exec fastlane android beta
91+
env:
92+
FASTLANE_ANDROID_JSON_KEY_FILE: ${{ steps.android_service_account_json_file.outputs.filePath }}
93+
94+
- name: 📁 Zip symbols
95+
id: zip-symbols
96+
run: |
97+
zip -r symbols.zip build/app/outputs/symbols/
98+
99+
- name: 📁 Upload build artifacts
100+
uses: actions/upload-artifact@v3
101+
with:
102+
name: assets
103+
path: |
104+
symbols.zip
105+
${{ github.workspace }}/build/app/outputs/bundle/release
106+
${{ github.workspace }}/build/app/outputs/flutter-apk
107+
108+
- name: 📝 Draft a GitHub release
109+
uses: softprops/action-gh-release@v2
110+
with:
111+
name: ${{ steps.splitted-version.outputs._0 }}
112+
tag_name: ${{ steps.splitted-version.outputs._0 }}
113+
draft: true
114+
fail_on_unmatched_files: true
115+
generate_release_notes: true
116+
files: |
117+
symbols.zip
118+
${{ github.workspace }}/build/app/outputs/bundle/release
119+
${{ github.workspace }}/build/app/outputs/flutter-apk
120+
121+
# - name: 🧪 Run Tests
122+
# shell: bash
123+
# run: flutter test --no-pub --test-randomize-ordering-seed random ${{inputs.testing_arguments}}
124+
125+
# - name: 📁 Save golden test failures artifacts
126+
# if: always()
127+
# uses: actions/upload-artifact@v3
128+
# with:
129+
# name: golden-test-failures
130+
# path: test/golden/failures
131+
# if-no-files-found: ignore
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Create a new Sweyer release
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: 📚 Git Checkout
10+
uses: actions/checkout@v3
11+
12+
- name: 🏗 Build and test Sweyer
13+
uses: ./.github/workflows/build_and_test
14+
with:
15+
testing_arguments: --coverage
16+
17+
- name: ☂ Upload Code Coverage
18+
uses: codecov/codecov-action@v3
19+
20+
- name: 🚀🤖 Bundle and deploy to Google Play
21+
uses: ./.github/workflows/deploy_google_play

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,15 @@ coverage
9696
.settings
9797

9898
temp/
99+
100+
# fastlane specific
101+
**/fastlane/report.xml
102+
103+
# deliver temporary files
104+
**/fastlane/Preview.html
105+
106+
# snapshot generated screenshots
107+
**/fastlane/screenshots
108+
109+
# scan temporary files
110+
**/fastlane/test_output

android/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"
4+
5+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
6+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

0 commit comments

Comments
 (0)