Skip to content

Commit 7d26cf4

Browse files
committed
feat: Add Fastlane automation for iOS builds and releases
- Add Fastfile with lanes for build, test, beta, and release - Configure Appfile for bundle identifier and team settings - Add Gemfile and Ruby version for dependency management - Update GitHub Actions workflows to use Fastlane - Add comprehensive Fastlane documentation - Add build automation scripts and utilities Fastlane lanes: - build: Build the app - build_simulator: Build for simulator (no signing) - test: Run tests - archive: Create distribution archive - beta: Upload to TestFlight - release: Submit to App Store - ci: CI/CD automation lane
1 parent b14ec90 commit 7d26cf4

File tree

16 files changed

+1047
-89
lines changed

16 files changed

+1047
-89
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,25 @@ jobs:
8383
restore-keys: |
8484
${{ runner.os }}-swift-
8585
86+
- name: Setup Ruby
87+
uses: ruby/setup-ruby@v1
88+
with:
89+
ruby-version: '3.2'
90+
bundler-cache: true
91+
working-directory: device-proof-recorder-ios
92+
93+
- name: Install Fastlane
94+
working-directory: device-proof-recorder-ios
95+
run: |
96+
bundle install
97+
8698
- name: Build iOS App
8799
working-directory: device-proof-recorder-ios
100+
env:
101+
GITHUB_RUN_NUMBER: ${{ github.run_number }}
102+
CI: 'true'
88103
run: |
89-
# Note: This assumes an Xcode project exists
90-
# xcodebuild -scheme DIGMVoiceMemo \
91-
# -configuration Release \
92-
# -destination 'generic/platform=iOS' \
93-
# clean build
94-
echo "iOS build placeholder - needs Xcode project file"
104+
bundle exec fastlane ci
95105
96106
- name: Upload Artifacts
97107
uses: actions/upload-artifact@v3

.github/workflows/release.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,45 @@ jobs:
5050
with:
5151
xcode-version: '15.0'
5252

53-
- name: Build and Archive
53+
- name: Setup Ruby
54+
uses: ruby/setup-ruby@v1
55+
with:
56+
ruby-version: '3.2'
57+
bundler-cache: true
58+
working-directory: device-proof-recorder-ios
59+
60+
- name: Install Fastlane
61+
working-directory: device-proof-recorder-ios
62+
run: |
63+
bundle install
64+
65+
- name: Setup App Store Connect API Key
66+
working-directory: device-proof-recorder-ios
67+
env:
68+
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_API_KEY_ID }}
69+
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }}
70+
APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APP_STORE_API_PRIVATE_KEY }}
71+
run: |
72+
echo "API key configured via environment variables"
73+
74+
- name: Build and Upload to TestFlight
5475
working-directory: device-proof-recorder-ios
76+
env:
77+
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_API_KEY_ID }}
78+
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }}
79+
APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APP_STORE_API_PRIVATE_KEY }}
80+
FASTLANE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
81+
GITHUB_RUN_NUMBER: ${{ github.run_number }}
5582
run: |
56-
# Build iOS app for release
57-
echo "iOS release build placeholder"
83+
bundle exec fastlane beta
5884
59-
- name: Upload to TestFlight
60-
uses: apple-actions/upload-testflight-build@v1
85+
- name: Upload Artifacts
86+
uses: actions/upload-artifact@v3
6187
with:
62-
app-path: device-proof-recorder-ios/build/DIGMVoiceMemo.xcarchive
63-
issuer-id: ${{ secrets.APP_STORE_ISSUER_ID }}
64-
api-key-id: ${{ secrets.APP_STORE_API_KEY_ID }}
65-
api-private-key: ${{ secrets.APP_STORE_API_PRIVATE_KEY }}
88+
name: ios-release
89+
path: |
90+
device-proof-recorder-ios/build/*.ipa
91+
device-proof-recorder-ios/build/*.xcarchive
92+
retention-days: 30
6693
if-no-files-found: ignore
6794

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Fastlane Configuration for DIGM ◉rigins
2+
3+
## Setup
4+
5+
1. **Install Fastlane**:
6+
```bash
7+
bundle install
8+
```
9+
10+
2. **Configure App Store Connect** (for TestFlight/App Store):
11+
12+
Option A: **App Store Connect API Key** (Recommended for CI/CD)
13+
- Create API key at: https://appstoreconnect.apple.com/access/api
14+
- Download key and save as `fastlane/api_key.json`
15+
- Or set environment variables:
16+
- `APP_STORE_CONNECT_API_KEY_ID`
17+
- `APP_STORE_CONNECT_API_ISSUER_ID`
18+
- `APP_STORE_CONNECT_API_KEY_CONTENT` (or `APP_STORE_CONNECT_API_KEY_PATH`)
19+
20+
Option B: **Apple ID Authentication**
21+
- Add your Apple ID to `fastlane/Appfile`
22+
- Fastlane will prompt for credentials
23+
24+
3. **Configure Team ID**:
25+
- Add your team ID to `fastlane/Appfile`
26+
- Or set `FASTLANE_TEAM_ID` environment variable
27+
28+
## Available Lanes
29+
30+
### Development
31+
```bash
32+
fastlane build # Build the app
33+
fastlane build_simulator # Build for simulator (no signing)
34+
fastlane test # Run tests
35+
```
36+
37+
### Distribution
38+
```bash
39+
fastlane beta # Build and upload to TestFlight
40+
fastlane release # Build and submit to App Store
41+
fastlane archive # Create archive only
42+
```
43+
44+
### Version Management
45+
```bash
46+
fastlane increment_build # Auto-increment build number
47+
fastlane increment_version # Set version (use VERSION_NUMBER="1.0.1")
48+
```
49+
50+
### Utilities
51+
```bash
52+
fastlane clean # Clean build artifacts
53+
fastlane generate_project # Regenerate Xcode project
54+
fastlane match # Sync certificates (if using match)
55+
fastlane ci # CI/CD lane (for GitHub Actions)
56+
```
57+
58+
## GitHub Actions Integration
59+
60+
Fastlane is already integrated into `.github/workflows/release.yml`
61+
62+
The `ci` lane handles:
63+
- Project generation
64+
- Build number increment from GitHub run number
65+
- Building for simulator (or archive for releases)
66+
67+
## Environment Variables
68+
69+
Set these in GitHub Secrets or locally:
70+
71+
- `APP_STORE_CONNECT_API_KEY_ID`
72+
- `APP_STORE_CONNECT_API_ISSUER_ID`
73+
- `APP_STORE_CONNECT_API_KEY_CONTENT` (or `_PATH`)
74+
- `FASTLANE_TEAM_ID`
75+
- `FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD` (for 2FA)
76+
77+
## Troubleshooting
78+
79+
### "No such module"
80+
- Run `fastlane generate_project` first
81+
82+
### Code signing errors
83+
- Ensure certificates are set up in Xcode
84+
- Or use `fastlane match` for automatic certificate management
85+
86+
### TestFlight upload fails
87+
- Check API key permissions
88+
- Verify bundle ID matches App Store Connect
89+
- Check app status in App Store Connect
90+
91+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Xcode project files
2+
*.xcodeproj/
3+
*.xcworkspace/
4+
build/
5+
DerivedData/
6+
*.xcuserstate
7+
*.xcuserdatad
8+
*.swiftpm/
9+
10+
# XcodeGen
11+
.swiftpm/
12+
13+
# Fastlane
14+
fastlane/report.xml
15+
fastlane/Preview.html
16+
fastlane/screenshots/
17+
fastlane/test_output/
18+
*.ipa
19+
*.app.dSYM.zip
20+
*.app.dSYM
21+
22+
# Match (if using match for certificates)
23+
fastlane/match_output/
24+
25+
# Deliver temporary files
26+
fastlane/deliver_output/
27+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
3.2.0
2+

0 commit comments

Comments
 (0)