1+ name : Build All Platforms
2+
3+ on :
4+ push :
5+ branches : [main]
6+ workflow_dispatch :
7+ inputs :
8+ build_android :
9+ description : ' Build Android APK'
10+ required : false
11+ default : true
12+ type : boolean
13+ build_ios :
14+ description : ' Build iOS IPA'
15+ required : false
16+ default : true
17+ type : boolean
18+
19+ jobs :
20+ build-android :
21+ if : ${{ github.event_name != 'workflow_dispatch' || inputs.build_android }}
22+ runs-on : ubuntu-latest
23+ outputs :
24+ upload_url : ${{ steps.create_release.outputs.upload_url }}
25+ defaults :
26+ run :
27+ working-directory : ./app
28+
29+ steps :
30+ - name : Setup repo
31+ uses : actions/checkout@v4
32+
33+ - name : Setup node
34+ uses : actions/setup-node@v4.0.2
35+ with :
36+ node-version : 20.x
37+ cache : ' npm'
38+ cache-dependency-path : ./app/package-lock.json
39+
40+ - name : Set up JDK 17
41+ uses : actions/setup-java@v4
42+ with :
43+ java-version : ' 17'
44+ distribution : ' temurin'
45+
46+ - name : Setup Android SDK
47+ uses : android-actions/setup-android@v3
48+
49+ - name : Setup Expo
50+ uses : expo/expo-github-action@v8
51+ with :
52+ expo-version : latest
53+ eas-version : latest
54+ token : ${{ secrets.EXPO_TOKEN }}
55+
56+ - name : Install dependencies
57+ run : npm ci
58+
59+ - name : Initialize EAS
60+ run : eas init --force --non-interactive
61+
62+ - name : Build Android APK
63+ run : eas build --platform android --profile local --local --output ${{ github.workspace }}/friend-lite-android.apk --non-interactive
64+
65+ - name : Generate release tag
66+ id : tag
67+ run : |
68+ echo "RELEASE_TAG=v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
69+ echo "RELEASE_NAME=Friend Lite Build $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
70+ echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
71+
72+ - name : Create Release
73+ id : create_release
74+ uses : actions/create-release@v1
75+ env :
76+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
77+ with :
78+ tag_name : ${{ steps.tag.outputs.RELEASE_TAG }}
79+ release_name : ${{ steps.tag.outputs.RELEASE_NAME }}
80+ body : |
81+ ## 🚀 Automated Build
82+
83+ **Built from commit:** ${{ github.sha }}
84+ **Branch:** ${{ github.ref_name }}
85+ **Build time:** ${{ steps.tag.outputs.BUILD_TIME }}
86+
87+ ### 📱 Downloads
88+ - **Android APK**: Ready for installation on Android devices
89+
90+ ### 🔧 Build Info
91+ - Built with GitHub Actions
92+ - Debug build (unsigned)
93+ - Safe for testing and development
94+ draft : false
95+ prerelease : true
96+
97+ - name : Upload Android APK to Release
98+ uses : actions/upload-release-asset@v1
99+ env :
100+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101+ with :
102+ upload_url : ${{ steps.create_release.outputs.upload_url }}
103+ asset_path : ${{ github.workspace }}/friend-lite-android.apk
104+ asset_name : friend-lite-android.apk
105+ asset_content_type : application/vnd.android.package-archive
106+
107+ build-ios :
108+ if : ${{ github.event_name != 'workflow_dispatch' || inputs.build_ios }}
109+ needs : build-android
110+ runs-on : macos-14
111+ defaults :
112+ run :
113+ working-directory : ./app
114+
115+ steps :
116+ - name : Setup repo
117+ uses : actions/checkout@v4
118+
119+ - name : Setup node
120+ uses : actions/setup-node@v4.0.2
121+ with :
122+ node-version : 20.x
123+ cache : ' npm'
124+ cache-dependency-path : ./app/package-lock.json
125+
126+ - name : Select Xcode version
127+ run : sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
128+
129+ - name : Setup Expo
130+ uses : expo/expo-github-action@v8
131+ with :
132+ expo-version : latest
133+ eas-version : latest
134+ token : ${{ secrets.EXPO_TOKEN }}
135+
136+ - name : Install dependencies
137+ run : npm ci
138+
139+ - name : Initialize EAS
140+ run : eas init --force --non-interactive
141+
142+ - name : Build iOS IPA
143+ run : eas build --platform ios --profile local --local --non-interactive --output ${{ github.workspace }}/friend-lite-ios.ipa
144+
145+ - name : Upload iOS IPA to Existing Release
146+ if : needs.build-android.result == 'success'
147+ uses : actions/upload-release-asset@v1
148+ env :
149+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150+ with :
151+ upload_url : ${{ needs.build-android.outputs.upload_url }}
152+ asset_path : ${{ github.workspace }}/friend-lite-ios.ipa
153+ asset_name : friend-lite-ios.ipa
154+ asset_content_type : application/octet-stream
155+
156+ - name : Generate iOS release info
157+ if : needs.build-android.result != 'success'
158+ id : ios_tag
159+ run : |
160+ echo "IOS_RELEASE_TAG=ios-v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
161+ echo "IOS_RELEASE_NAME=Friend Lite iOS $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
162+ echo "IOS_BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
163+
164+ - name : Create iOS-only Release
165+ if : needs.build-android.result != 'success'
166+ id : create_ios_release
167+ uses : actions/create-release@v1
168+ env :
169+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
170+ with :
171+ tag_name : ${{ steps.ios_tag.outputs.IOS_RELEASE_TAG }}
172+ release_name : ${{ steps.ios_tag.outputs.IOS_RELEASE_NAME }}
173+ body : |
174+ ## 🍎 iOS IPA Build
175+
176+ **Built from commit:** ${{ github.sha }}
177+ **Branch:** ${{ github.ref_name }}
178+ **Build time:** ${{ steps.ios_tag.outputs.IOS_BUILD_TIME }}
179+
180+ For iOS Simulator testing!
181+ draft : false
182+ prerelease : true
183+
184+ - name : Upload iOS IPA to New Release
185+ if : needs.build-android.result != 'success'
186+ uses : actions/upload-release-asset@v1
187+ env :
188+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
189+ with :
190+ upload_url : ${{ steps.create_ios_release.outputs.upload_url }}
191+ asset_path : ${{ github.workspace }}/friend-lite-ios.ipa
192+ asset_name : friend-lite-ios.ipa
193+ asset_content_type : application/octet-stream
0 commit comments