-
Notifications
You must be signed in to change notification settings - Fork 25
194 lines (164 loc) · 6.17 KB
/
build-all-platforms.yml
File metadata and controls
194 lines (164 loc) · 6.17 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Build All Platforms
on:
push:
branches: [main]
paths: ['app/**']
workflow_dispatch:
inputs:
build_android:
description: 'Build Android APK'
required: false
default: true
type: boolean
build_ios:
description: 'Build iOS IPA'
required: false
default: true
type: boolean
jobs:
build-android:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build_android }}
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
defaults:
run:
working-directory: ./app
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'npm'
cache-dependency-path: ./app/package-lock.json
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Initialize EAS
run: eas init --force --non-interactive
- name: Build Android APK
run: eas build --platform android --profile local --local --output ${{ github.workspace }}/friend-lite-android.apk --non-interactive
- name: Generate release tag
id: tag
run: |
echo "RELEASE_TAG=v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
echo "RELEASE_NAME=Friend Lite Build $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.RELEASE_TAG }}
release_name: ${{ steps.tag.outputs.RELEASE_NAME }}
body: |
## 🚀 Automated Build
**Built from commit:** ${{ github.sha }}
**Branch:** ${{ github.ref_name }}
**Build time:** ${{ steps.tag.outputs.BUILD_TIME }}
### 📱 Downloads
- **Android APK**: Ready for installation on Android devices
### 🔧 Build Info
- Built with GitHub Actions
- Debug build (unsigned)
- Safe for testing and development
draft: false
prerelease: true
- name: Upload Android APK to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/friend-lite-android.apk
asset_name: friend-lite-android.apk
asset_content_type: application/vnd.android.package-archive
build-ios:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build_ios }}
needs: build-android
runs-on: macos-14
defaults:
run:
working-directory: ./app
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'npm'
cache-dependency-path: ./app/package-lock.json
- name: Select Xcode version
run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Initialize EAS
run: eas init --force --non-interactive
- name: Build iOS IPA
run: eas build --platform ios --profile local --local --non-interactive --output ${{ github.workspace }}/friend-lite-ios.ipa
- name: Upload iOS IPA to Existing Release
if: needs.build-android.result == 'success'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build-android.outputs.upload_url }}
asset_path: ${{ github.workspace }}/friend-lite-ios.ipa
asset_name: friend-lite-ios.ipa
asset_content_type: application/octet-stream
- name: Generate iOS release info
if: needs.build-android.result != 'success'
id: ios_tag
run: |
echo "IOS_RELEASE_TAG=ios-v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
echo "IOS_RELEASE_NAME=Friend Lite iOS $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "IOS_BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
- name: Create iOS-only Release
if: needs.build-android.result != 'success'
id: create_ios_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.ios_tag.outputs.IOS_RELEASE_TAG }}
release_name: ${{ steps.ios_tag.outputs.IOS_RELEASE_NAME }}
body: |
## 🍎 iOS IPA Build
**Built from commit:** ${{ github.sha }}
**Branch:** ${{ github.ref_name }}
**Build time:** ${{ steps.ios_tag.outputs.IOS_BUILD_TIME }}
For iOS Simulator testing!
draft: false
prerelease: true
- name: Upload iOS IPA to New Release
if: needs.build-android.result != 'success'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_ios_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/friend-lite-ios.ipa
asset_name: friend-lite-ios.ipa
asset_content_type: application/octet-stream