Repository navigation
150 lines (120 loc) · 4.54 KB
/
Copy pathdevelop-deploy.yml
File metadata and controls
150 lines (120 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Develop Deploy
on:
push:
branches: [develop]
concurrency:
group: develop-deploy
cancel-in-progress: false
jobs:
deploy-ios:
name: Deploy to TestFlight
runs-on: [self-hosted, macOS]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure SSH for private dependency
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add hosts to known_hosts
run: |
ssh-keyscan -p 2822 git.techstackapps.com >> ~/.ssh/known_hosts
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Restore API key from secret
env:
ASC_KEY_CONTENT: ${{ secrets.ASC_KEY_CONTENT }}
run: |
mkdir -p ios/fastlane/private_keys
printf '%s\n' "$ASC_KEY_CONTENT" > ios/fastlane/private_keys/AuthKey.p8
- name: Install dependencies
run: fvm flutter pub get
- name: Run code generation
run: fvm dart run build_runner build --delete-conflicting-outputs
- name: Install CocoaPods dependencies
run: cd ios && rm -rf Podfile.lock Pods && pod install --repo-update
- name: Install Fastlane dependencies
run: cd ios && bundle install
- name: Setup CI keychain
run: |
security create-keychain -p "ci" ci_build.keychain-db || true
security unlock-keychain -p "ci" ci_build.keychain-db
security set-keychain-settings -t 3600 -u ci_build.keychain-db
security list-keychains -d user -s ci_build.keychain-db login.keychain-db
security default-keychain -s ci_build.keychain-db
- name: Deploy to TestFlight
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_PATH: ./private_keys/AuthKey.p8
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ci_build.keychain-db
MATCH_KEYCHAIN_PASSWORD: ci
run: |
cd ios
bundle exec fastlane beta
- name: Cleanup
if: always()
run: |
security delete-keychain ci_build.keychain-db || true
security list-keychains -d user -s login.keychain-db
security default-keychain -s login.keychain-db
rm -rf ios/fastlane/private_keys
deploy-android:
name: Deploy to Play Store
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure SSH for private dependency
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add private dependency host to known_hosts
run: ssh-keyscan -p 2822 git.techstackapps.com >> ~/.ssh/known_hosts
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.32.4"
cache: true
- name: Create .env file
run: echo "${{ secrets.ENV_FILE_CONTENT }}" > .env
- name: Decode keystore
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks
- name: Write key.properties
run: |
cat > android/key.properties << EOF
storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}
keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}
keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}
storeFile=upload-keystore.jks
EOF
- name: Install dependencies
run: flutter pub get
- name: Run code generation
run: dart run build_runner build --delete-conflicting-outputs
- name: Reduce Gradle heap for CI
run: sed -i 's/-Xmx8G/-Xmx4G/' android/gradle.properties
- name: Decode service account JSON
run: echo "${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_BASE64 }}" | base64 --decode > android/fastlane/service-account.json
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
working-directory: android
- name: Deploy to Google Play
run: |
cd android
bundle exec fastlane beta
- name: Cleanup sensitive files
if: always()
run: |
rm -f android/app/upload-keystore.jks
rm -f android/key.properties
rm -f android/fastlane/service-account.json