|
| 1 | +# GitHub Repository Setup Guide |
| 2 | + |
| 3 | +This guide explains how to set up your GitHub repository for automated builds and releases of Mac Snap. |
| 4 | + |
| 5 | +## 🔐 Required GitHub Secrets |
| 6 | + |
| 7 | +To enable automated builds and releases, add these secrets to your GitHub repository: |
| 8 | + |
| 9 | +### Repository Settings → Secrets and Variables → Actions |
| 10 | + |
| 11 | +#### For General Releases (Required) |
| 12 | +These secrets enable basic building and DMG creation: |
| 13 | + |
| 14 | +- **No secrets required** for basic unsigned builds |
| 15 | +- The workflow will create unsigned builds automatically |
| 16 | + |
| 17 | +#### For Code-Signed Releases (Recommended) |
| 18 | +For signed releases that users can install without security warnings: |
| 19 | + |
| 20 | +``` |
| 21 | +CERTIFICATES_P12 |
| 22 | +``` |
| 23 | +- **Description:** Base64-encoded .p12 certificate file |
| 24 | +- **How to get:** Export your Developer ID certificate from Keychain Access |
| 25 | +- **Command:** `base64 -i YourCertificate.p12 | pbcopy` |
| 26 | + |
| 27 | +``` |
| 28 | +CERTIFICATES_PASSWORD |
| 29 | +``` |
| 30 | +- **Description:** Password for the .p12 certificate file |
| 31 | +- **Value:** The password you set when exporting the certificate |
| 32 | + |
| 33 | +#### For App Store Releases (Optional) |
| 34 | +If you want to automatically upload to App Store Connect: |
| 35 | + |
| 36 | +``` |
| 37 | +APPSTORE_ISSUER_ID |
| 38 | +``` |
| 39 | +- **Description:** App Store Connect API issuer ID |
| 40 | +- **Found in:** App Store Connect → Users and Access → Integrations → App Store Connect API |
| 41 | + |
| 42 | +``` |
| 43 | +APPSTORE_KEY_ID |
| 44 | +``` |
| 45 | +- **Description:** App Store Connect API key ID |
| 46 | +- **Found in:** Same location as issuer ID |
| 47 | + |
| 48 | +``` |
| 49 | +APPSTORE_PRIVATE_KEY |
| 50 | +``` |
| 51 | +- **Description:** App Store Connect API private key (base64 encoded) |
| 52 | +- **How to get:** Download .p8 file, then `base64 -i AuthKey_XXXXXX.p8 | pbcopy` |
| 53 | + |
| 54 | +``` |
| 55 | +APP_STORE_CERTIFICATES_P12 |
| 56 | +``` |
| 57 | +- **Description:** Base64-encoded Mac App Store certificate |
| 58 | +- **How to get:** Export Mac App Store certificate from Keychain Access |
| 59 | + |
| 60 | +``` |
| 61 | +APP_STORE_CERTIFICATES_PASSWORD |
| 62 | +``` |
| 63 | +- **Description:** Password for the App Store certificate |
| 64 | + |
| 65 | +## 🚀 How to Create Releases |
| 66 | + |
| 67 | +### Automatic Releases |
| 68 | + |
| 69 | +1. **Create a Git tag:** |
| 70 | + ```bash |
| 71 | + git tag v1.0.0 |
| 72 | + git push origin v1.0.0 |
| 73 | + ``` |
| 74 | + |
| 75 | +2. **GitHub Actions will automatically:** |
| 76 | + - Build the app |
| 77 | + - Run tests |
| 78 | + - Create DMG installer |
| 79 | + - Generate release notes |
| 80 | + - Upload to GitHub Releases |
| 81 | + |
| 82 | +### Manual Builds |
| 83 | + |
| 84 | +For development/testing builds: |
| 85 | + |
| 86 | +1. **Push to any branch** - Creates unsigned build artifacts |
| 87 | +2. **Push to main** - Creates App Store build (if configured) |
| 88 | +3. **Push tags** - Creates full release with DMG |
| 89 | + |
| 90 | +## 📋 Workflow Overview |
| 91 | + |
| 92 | +The GitHub Actions workflow includes three jobs: |
| 93 | + |
| 94 | +### 1. Build and Test Job |
| 95 | +- **Triggers:** All pushes and pull requests |
| 96 | +- **Actions:** |
| 97 | + - Builds debug version |
| 98 | + - Runs unit tests |
| 99 | + - Creates unsigned release build |
| 100 | + - Uploads artifacts for download |
| 101 | + |
| 102 | +### 2. Release Job |
| 103 | +- **Triggers:** Git tags (v*.*.*) |
| 104 | +- **Actions:** |
| 105 | + - Builds signed release |
| 106 | + - Creates professional DMG installer |
| 107 | + - Generates release notes |
| 108 | + - Creates GitHub release |
| 109 | + - Uploads DMG for distribution |
| 110 | + |
| 111 | +### 3. App Store Job |
| 112 | +- **Triggers:** Main branch and tags |
| 113 | +- **Actions:** |
| 114 | + - Builds App Store version |
| 115 | + - Uploads to App Store Connect (if configured) |
| 116 | + |
| 117 | +## 🛠️ Local Development Builds |
| 118 | + |
| 119 | +To create a DMG locally: |
| 120 | + |
| 121 | +```bash |
| 122 | +# Build and create DMG |
| 123 | +./scripts/create_dmg.sh |
| 124 | + |
| 125 | +# The DMG will be created in dist/ folder |
| 126 | +open dist/ |
| 127 | +``` |
| 128 | + |
| 129 | +## 📦 Release Strategy |
| 130 | + |
| 131 | +### Version Numbering |
| 132 | +- Use semantic versioning: `v1.0.0`, `v1.1.0`, `v2.0.0` |
| 133 | +- Pre-releases: `v1.0.0-beta.1`, `v1.0.0-alpha.1` |
| 134 | + |
| 135 | +### Release Frequency |
| 136 | +- **Major releases** (v2.0.0): New features, breaking changes |
| 137 | +- **Minor releases** (v1.1.0): New features, no breaking changes |
| 138 | +- **Patch releases** (v1.0.1): Bug fixes only |
| 139 | + |
| 140 | +### Release Process |
| 141 | +1. Update CHANGELOG.md with new version |
| 142 | +2. Commit changes to main branch |
| 143 | +3. Create and push git tag |
| 144 | +4. GitHub Actions handles the rest! |
| 145 | + |
| 146 | +## 🔍 Monitoring Builds |
| 147 | + |
| 148 | +### Check Build Status |
| 149 | +- Visit your repository's "Actions" tab |
| 150 | +- Monitor build progress and logs |
| 151 | +- Download artifacts for testing |
| 152 | + |
| 153 | +### Build Artifacts |
| 154 | +- **Unsigned builds:** Available for 7 days |
| 155 | +- **Release DMGs:** Available for 90 days |
| 156 | +- **GitHub Releases:** Permanent until deleted |
| 157 | + |
| 158 | +## 🐛 Troubleshooting |
| 159 | + |
| 160 | +### Common Issues |
| 161 | + |
| 162 | +**Build fails with signing errors:** |
| 163 | +- Check that certificate secrets are properly base64 encoded |
| 164 | +- Verify certificate password is correct |
| 165 | +- Ensure certificate hasn't expired |
| 166 | + |
| 167 | +**DMG creation fails:** |
| 168 | +- Check that `scripts/create_dmg.sh` is executable |
| 169 | +- Verify all required files exist (README.md, LICENSE) |
| 170 | +- Check disk space on GitHub runner |
| 171 | + |
| 172 | +**App Store upload fails:** |
| 173 | +- Verify App Store Connect API credentials |
| 174 | +- Check bundle ID matches App Store Connect |
| 175 | +- Ensure app version is incremented |
| 176 | + |
| 177 | +### Getting Help |
| 178 | + |
| 179 | +1. **Check build logs** in GitHub Actions |
| 180 | +2. **Review secrets** are properly configured |
| 181 | +3. **Test locally** using the build scripts |
| 182 | +4. **Open an issue** if problems persist |
| 183 | + |
| 184 | +--- |
| 185 | + |
| 186 | +**Ready to automate your Mac Snap releases! 🚀** |
0 commit comments