Skip to content

Commit 506f7e8

Browse files
Merge pull request #32 from neooriginal/main
github actions for automatic deployment
2 parents 5f5fb24 + 28f336b commit 506f7e8

4 files changed

Lines changed: 387 additions & 0 deletions

File tree

.github/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# GitHub Actions CI/CD Setup for Friend Lite
2+
3+
This sets up **automatic GitHub releases** with APK/IPA files whenever you push code.
4+
5+
## 🚀 How This Works
6+
7+
1. You push code to GitHub
8+
2. GitHub automatically builds **both Android APK and iOS IPA**
9+
3. **Creates GitHub Releases** with both files attached
10+
4. You download directly from the **Releases** tab!
11+
12+
## 🎯 Quick Setup (2 Steps)
13+
14+
### Step 1: Get Expo Token
15+
1. Go to [expo.dev](https://expo.dev) and sign in/create account
16+
2. Go to [Access Tokens](https://expo.dev/accounts/[account]/settings/access-tokens)
17+
3. Create a new token and copy it
18+
19+
### Step 2: Add GitHub Secret
20+
1. In your GitHub repo: **Settings****Secrets and variables****Actions**
21+
2. Click **New repository secret**
22+
3. Name: `EXPO_TOKEN`
23+
4. Value: Paste your token from Step 1
24+
5. Click **Add secret**
25+
26+
## ⚡ That's It!
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Android APK Build
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: ./app
16+
17+
steps:
18+
- name: Setup repo
19+
uses: actions/checkout@v4
20+
21+
- name: Setup node
22+
uses: actions/setup-node@v4.0.2
23+
with:
24+
node-version: 20.x
25+
cache: 'npm'
26+
cache-dependency-path: ./app/package-lock.json
27+
28+
- name: Set up JDK 17
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: '17'
32+
distribution: 'temurin'
33+
34+
- name: Setup Android SDK
35+
uses: android-actions/setup-android@v3
36+
37+
- name: Setup Expo
38+
uses: expo/expo-github-action@v8
39+
with:
40+
expo-version: latest
41+
eas-version: latest
42+
token: ${{ secrets.EXPO_TOKEN }}
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Initialize EAS
48+
run: eas init --force --non-interactive
49+
50+
- name: Build Android APK
51+
run: eas build --platform android --profile local --local --output ${{ github.workspace }}/app-release.apk --non-interactive
52+
53+
- name: Generate release tag
54+
id: tag
55+
run: |
56+
echo "RELEASE_TAG=android-v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
57+
echo "RELEASE_NAME=Friend Lite Android $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
58+
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
59+
60+
- name: Create Release
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
tag_name: ${{ steps.tag.outputs.RELEASE_TAG }}
67+
release_name: ${{ steps.tag.outputs.RELEASE_NAME }}
68+
body: |
69+
## 📱 Android APK Build
70+
71+
**Built from commit:** ${{ github.sha }}
72+
**Branch:** ${{ github.ref_name }}
73+
**Build time:** ${{ steps.tag.outputs.BUILD_TIME }}
74+
75+
Ready to install on Android devices!
76+
draft: false
77+
prerelease: true
78+
79+
- name: Upload Android APK to Release
80+
uses: actions/upload-release-asset@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
upload_url: ${{ steps.create_release.outputs.upload_url }}
85+
asset_path: ${{ github.workspace }}/app-release.apk
86+
asset_name: friend-lite-android.apk
87+
asset_content_type: application/vnd.android.package-archive
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
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
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: iOS IPA Build
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: macos-14
13+
defaults:
14+
run:
15+
working-directory: ./app
16+
17+
steps:
18+
- name: Setup repo
19+
uses: actions/checkout@v4
20+
21+
- name: Setup node
22+
uses: actions/setup-node@v4.0.2
23+
with:
24+
node-version: 20.x
25+
cache: 'npm'
26+
cache-dependency-path: ./app/package-lock.json
27+
28+
- name: Select Xcode version
29+
run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
30+
31+
- name: Setup Expo
32+
uses: expo/expo-github-action@v8
33+
with:
34+
expo-version: latest
35+
eas-version: latest
36+
token: ${{ secrets.EXPO_TOKEN }}
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Initialize EAS
42+
run: eas init --force --non-interactive
43+
44+
- name: Build iOS IPA
45+
run: eas build --platform ios --profile local --local --non-interactive --output ${{ github.workspace }}/app-release.ipa
46+
47+
- name: Generate release tag
48+
id: tag
49+
run: |
50+
echo "RELEASE_TAG=ios-v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
51+
echo "RELEASE_NAME=Friend Lite iOS $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
52+
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
53+
54+
- name: Create Release
55+
id: create_release
56+
uses: actions/create-release@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: ${{ steps.tag.outputs.RELEASE_TAG }}
61+
release_name: ${{ steps.tag.outputs.RELEASE_NAME }}
62+
body: |
63+
## 🍎 iOS IPA Build
64+
65+
**Built from commit:** ${{ github.sha }}
66+
**Branch:** ${{ github.ref_name }}
67+
**Build time:** ${{ steps.tag.outputs.BUILD_TIME }}
68+
69+
For iOS Simulator testing!
70+
draft: false
71+
prerelease: true
72+
73+
- name: Upload iOS IPA to Release
74+
uses: actions/upload-release-asset@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
upload_url: ${{ steps.create_release.outputs.upload_url }}
79+
asset_path: ${{ github.workspace }}/app-release.ipa
80+
asset_name: friend-lite-ios.ipa
81+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)