|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v*'] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + mac: |
| 9 | + description: Build, sign and notarize the Mac app |
| 10 | + type: boolean |
| 11 | + default: true |
| 12 | + ios: |
| 13 | + description: Build the iOS app and upload it to App Store Connect |
| 14 | + type: boolean |
| 15 | + default: true |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +env: |
| 21 | + TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + mac: |
| 25 | + name: Mac app (Developer ID) |
| 26 | + if: github.event_name == 'push' || inputs.mac |
| 27 | + runs-on: macos-26 |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 31 | + with: |
| 32 | + xcode-version: latest-stable |
| 33 | + |
| 34 | + - name: Version |
| 35 | + id: version |
| 36 | + run: | |
| 37 | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then v="${GITHUB_REF#refs/tags/v}"; else v="$(grep -m1 'MARKETING_VERSION' project.yml | awk '{print $2}')"; fi |
| 38 | + echo "version=$v" >> "$GITHUB_OUTPUT" |
| 39 | + echo "build=$((GITHUB_RUN_NUMBER + 100))" >> "$GITHUB_OUTPUT" |
| 40 | +
|
| 41 | + - name: Import Developer ID certificate |
| 42 | + env: |
| 43 | + P12: ${{ secrets.MAC_CERTIFICATE_P12 }} |
| 44 | + P12_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }} |
| 45 | + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} |
| 46 | + run: scripts/ci-keychain.sh "$P12" "$P12_PASSWORD" "$KEYCHAIN_PASSWORD" |
| 47 | + |
| 48 | + - name: Store App Store Connect key |
| 49 | + env: |
| 50 | + KEY: ${{ secrets.ASC_KEY_P8 }} |
| 51 | + run: | |
| 52 | + mkdir -p ~/.appstoreconnect/private_keys |
| 53 | + echo "$KEY" > ~/.appstoreconnect/private_keys/AuthKey_${{ secrets.ASC_KEY_ID }}.p8 |
| 54 | +
|
| 55 | + - name: Archive |
| 56 | + run: | |
| 57 | + xcodebuild archive \ |
| 58 | + -project Spanscreen.xcodeproj \ |
| 59 | + -scheme SpanscreenMac \ |
| 60 | + -destination generic/platform=macOS \ |
| 61 | + -archivePath build/Spanscreen-mac.xcarchive \ |
| 62 | + MARKETING_VERSION=${{ steps.version.outputs.version }} \ |
| 63 | + CURRENT_PROJECT_VERSION=${{ steps.version.outputs.build }} \ |
| 64 | + CODE_SIGN_STYLE=Manual \ |
| 65 | + CODE_SIGN_IDENTITY="Developer ID Application" \ |
| 66 | + DEVELOPMENT_TEAM=$TEAM_ID \ |
| 67 | + OTHER_CODE_SIGN_FLAGS="--timestamp" | xcbeautify --renderer github-actions || exit ${PIPESTATUS[0]} |
| 68 | +
|
| 69 | + - name: Package, notarize and staple |
| 70 | + env: |
| 71 | + ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} |
| 72 | + ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} |
| 73 | + run: scripts/package-mac.sh build/Spanscreen-mac.xcarchive/Products/Applications/Spanscreen.app build/Spanscreen.dmg |
| 74 | + |
| 75 | + - uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: Spanscreen-mac |
| 78 | + path: build/Spanscreen.dmg |
| 79 | + |
| 80 | + - name: Publish release |
| 81 | + if: startsWith(github.ref, 'refs/tags/v') |
| 82 | + env: |
| 83 | + GH_TOKEN: ${{ github.token }} |
| 84 | + run: | |
| 85 | + tag="${GITHUB_REF#refs/tags/}" |
| 86 | + gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --title "Spanscreen ${tag#v}" --generate-notes |
| 87 | + gh release upload "$tag" build/Spanscreen.dmg --clobber |
| 88 | +
|
| 89 | + ios: |
| 90 | + name: iOS app (App Store) |
| 91 | + if: github.event_name == 'push' || inputs.ios |
| 92 | + runs-on: macos-26 |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 96 | + with: |
| 97 | + xcode-version: latest-stable |
| 98 | + |
| 99 | + - name: Version |
| 100 | + id: version |
| 101 | + run: | |
| 102 | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then v="${GITHUB_REF#refs/tags/v}"; else v="$(grep -m1 'MARKETING_VERSION' project.yml | awk '{print $2}')"; fi |
| 103 | + echo "version=$v" >> "$GITHUB_OUTPUT" |
| 104 | + echo "build=$((GITHUB_RUN_NUMBER + 100))" >> "$GITHUB_OUTPUT" |
| 105 | +
|
| 106 | + - name: Import distribution certificate and profile |
| 107 | + env: |
| 108 | + P12: ${{ secrets.IOS_CERTIFICATE_P12 }} |
| 109 | + P12_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }} |
| 110 | + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} |
| 111 | + PROFILE: ${{ secrets.IOS_PROVISIONING_PROFILE }} |
| 112 | + run: | |
| 113 | + scripts/ci-keychain.sh "$P12" "$P12_PASSWORD" "$KEYCHAIN_PASSWORD" |
| 114 | + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles |
| 115 | + echo "$PROFILE" | base64 --decode > profile.mobileprovision |
| 116 | + uuid=$(security cms -D -i profile.mobileprovision | plutil -extract UUID raw -) |
| 117 | + cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision |
| 118 | + echo "PROFILE_UUID=$uuid" >> "$GITHUB_ENV" |
| 119 | +
|
| 120 | + - name: Store App Store Connect key |
| 121 | + env: |
| 122 | + KEY: ${{ secrets.ASC_KEY_P8 }} |
| 123 | + run: | |
| 124 | + mkdir -p ~/.appstoreconnect/private_keys |
| 125 | + echo "$KEY" > ~/.appstoreconnect/private_keys/AuthKey_${{ secrets.ASC_KEY_ID }}.p8 |
| 126 | +
|
| 127 | + - name: Archive |
| 128 | + run: | |
| 129 | + xcodebuild archive \ |
| 130 | + -project Spanscreen.xcodeproj \ |
| 131 | + -scheme SpanscreenIOS \ |
| 132 | + -destination generic/platform=iOS \ |
| 133 | + -archivePath build/Spanscreen-ios.xcarchive \ |
| 134 | + MARKETING_VERSION=${{ steps.version.outputs.version }} \ |
| 135 | + CURRENT_PROJECT_VERSION=${{ steps.version.outputs.build }} \ |
| 136 | + CODE_SIGN_STYLE=Manual \ |
| 137 | + CODE_SIGN_IDENTITY="iPhone Distribution" \ |
| 138 | + PROVISIONING_PROFILE_SPECIFIER=$PROFILE_UUID \ |
| 139 | + DEVELOPMENT_TEAM=$TEAM_ID | xcbeautify --renderer github-actions || exit ${PIPESTATUS[0]} |
| 140 | +
|
| 141 | + - name: Export |
| 142 | + run: | |
| 143 | + sed -e "s/__TEAM__/$TEAM_ID/" -e "s/__PROFILE__/$PROFILE_UUID/" scripts/ExportOptions-ios.plist > build/ExportOptions.plist |
| 144 | + xcodebuild -exportArchive -archivePath build/Spanscreen-ios.xcarchive -exportPath build/ios -exportOptionsPlist build/ExportOptions.plist |
| 145 | +
|
| 146 | + - uses: actions/upload-artifact@v4 |
| 147 | + with: |
| 148 | + name: Spanscreen-ios |
| 149 | + path: build/ios/*.ipa |
| 150 | + |
| 151 | + - name: Upload to App Store Connect |
| 152 | + run: | |
| 153 | + xcrun altool --upload-app -f build/ios/Spanscreen.ipa -t ios \ |
| 154 | + --apiKey "${{ secrets.ASC_KEY_ID }}" --apiIssuer "${{ secrets.ASC_ISSUER_ID }}" |
0 commit comments