- Creates workflow for building without Apple Developer Program - Uses Apple-Actions for certificate import - Outputs .app file as artifact for sideloading See ADHOC_BUILD_GUIDE.md for setup instructions
112 lines
4 KiB
Markdown
112 lines
4 KiB
Markdown
# iOS Ad-Hoc Build Setup Guide
|
||
|
||
This guide walks you through setting up ad-hoc signing for your Bagsy iOS app without an Apple Developer Program membership.
|
||
|
||
## Prerequisites
|
||
|
||
1. **Free Apple ID** - Use your personal Apple ID
|
||
2. **Your iPhone 16 connected to Mac** via USB
|
||
3. **GitHub account** to store secrets
|
||
|
||
## Step 1: Get Your iPhone UDID
|
||
|
||
1. Connect iPhone 16 to Mac via USB
|
||
2. Open Finder → Click on your iPhone in the sidebar
|
||
3. Click the phone icon in the top bar of the Finder window
|
||
4. Look for "Serial Number" or click on the info icon (ℹ️)
|
||
5. Click on the serial number - it will change to show "UDID"
|
||
6. Copy the UDID (it looks like: `00001234-0001234567ABCDEF`)
|
||
|
||
## Step 2: Create Signing Certificate (Mac)
|
||
|
||
```bash
|
||
# 1. Create a Certificate Signing Request (CSR)
|
||
cd ~/Documents
|
||
mkdir csr
|
||
cd csr
|
||
|
||
# This will create a public/private key pair
|
||
security create-keychain -p "BagsyKeychain" Bagsy.keychain
|
||
security set-keychain-settings -t 9600 -l Bagsy.keychain
|
||
|
||
# Generate the CSR
|
||
security keychain default -keychain ~/Library/Keychains/login.keychain
|
||
security find-certificate -c "Apple Development" login.keychain
|
||
|
||
# Use Keychain Access app:
|
||
# 1. Open Keychain Access
|
||
# 2. Menu: Keychain Access → Certificate Assistant → Request a Certificate Authority...
|
||
# 3. Choose "Saved to disk"
|
||
# 4. Enter your email and name
|
||
# 5. Save as "BagsySigningRequest.certSigningRequest"
|
||
```
|
||
|
||
## Step 3: Get Free Certificate from Apple
|
||
|
||
1. Go to https://developer.apple.com/account
|
||
2. Sign in with your free Apple ID
|
||
3. Click "Certificates, Identifiers & Profiles"
|
||
4. Click "+" to create a new certificate
|
||
5. Select "Apple Development" or "Apple Distribution"
|
||
6. Upload your CSR file
|
||
7. Download the certificate (`.cer` file)
|
||
|
||
## Step 4: Convert to P12 (Mac)
|
||
|
||
```bash
|
||
# Open the .cer file by double-clicking to install to Keychain
|
||
# Then export as p12:
|
||
|
||
# Open Keychain Access, find your certificate
|
||
# Right click → Export → Save as "Bagsy.p12"
|
||
# Set a password (remember this!)
|
||
```
|
||
|
||
## Step 5: Create Ad-Hoc Provisioning Profile (Mac)
|
||
|
||
1. Go to https://developer.apple.com/account → Certificates
|
||
2. Click "+" → Select "Ad Hoc"
|
||
3. Choose your App ID (create if needed: `com.barnabas.bagsy`)
|
||
4. Select your certificate from Step 3
|
||
5. Add your iPhone UDID from Step 1
|
||
6. Name it: "Bagsy Ad-Hoc"
|
||
7. Download the `.mobileprovision` file
|
||
|
||
## Step 6: Setup GitHub Secrets
|
||
|
||
Go to your GitHub repo → Settings → Secrets → Actions and add:
|
||
|
||
| Secret Name | Value |
|
||
| ---------------------- | ----------------------------------------------------------------------------------- |
|
||
| `CERTIFICATE` | Base64 of your `.p12` file: `base64 -w0 Bagsy.p12` |
|
||
| `KEY_PASSWORD` | Password you set for keychain |
|
||
| `P12_PASSWORD` | Password you set when exporting p12 |
|
||
| `CERTIFICATE_NAME` | "Apple Distribution: Your Name (TEAMID)" or "Apple Development: Your Name (TEAMID)" |
|
||
| `PROVISIONING_PROFILE` | Base64 of mobileprovision: `base64 -w0 Bagsy.mobileprovision` |
|
||
| `PROFILE_NAME` | "Bagsy Ad-Hoc" |
|
||
|
||
## Step 7: Run the Build
|
||
|
||
1. Push to main branch, or
|
||
2. Go to GitHub Actions → Build iOS Ad-Hoc → Run workflow
|
||
|
||
## Generating Base64 Values
|
||
|
||
```bash
|
||
# Get base64 for certificate (Mac terminal)
|
||
base64 -w0 Bagsy.p12
|
||
# Copy output as CERTIFICATE secret
|
||
|
||
# Get base64 for provisioning profile
|
||
base64 -w0 Bagsy\ Ad-Hoc.mobileprovision
|
||
# Copy output as PROVISIONING_PROFILE secret
|
||
```
|
||
|
||
---
|
||
|
||
**Note:** This creates an unsigned build that can be installed on YOUR iPhone 16 only (because it's ad-hoc with your UDID embedded). To test, you'll need to either:
|
||
|
||
- Download the .app from GitHub Actions and sideload via Xcode
|
||
- Or use a tool like idevicelocation 管理与配置
|
||
|
||
Let me also update the workflow to be more correct:
|