|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: Build and sign app |
| 10 | + permissions: |
| 11 | + contents: write |
| 12 | + runs-on: macos-26 |
| 13 | + environment: main |
| 14 | + env: |
| 15 | + projname: "MewNotch" |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Install create-dmg |
| 21 | + run: brew install create-dmg |
| 22 | + |
| 23 | + - name: Resolve Swift packages |
| 24 | + run: xcodebuild -resolvePackageDependencies -project ${{ env.projname }}.xcodeproj |
| 25 | + |
| 26 | + - name: Install Apple certificate |
| 27 | + env: |
| 28 | + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} |
| 29 | + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} |
| 30 | + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} |
| 31 | + run: | |
| 32 | + CERT_PATH=$RUNNER_TEMP/build_certificate.p12 |
| 33 | + KC=$RUNNER_TEMP/app-signing.keychain-db |
| 34 | + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode > "$CERT_PATH" |
| 35 | + security create-keychain -p "$KEYCHAIN_PASSWORD" "$KC" |
| 36 | + security set-keychain-settings -lut 21600 "$KC" |
| 37 | + security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KC" |
| 38 | + security import "$CERT_PATH" -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k "$KC" |
| 39 | + security list-keychain -d user -s "$KC" |
| 40 | + security find-identity -v -p codesigning |
| 41 | +
|
| 42 | + - name: Build with Xcode 26 |
| 43 | + run: xcodebuild -version |
| 44 | + |
| 45 | + - name: Build and archive |
| 46 | + run: | |
| 47 | + xcodebuild clean archive \ |
| 48 | + -project ${{ env.projname }}.xcodeproj \ |
| 49 | + -scheme ${{ env.projname }} \ |
| 50 | + -archivePath ${{ env.projname }} \ |
| 51 | + -destination "generic/platform=macOS" \ |
| 52 | + ONLY_ACTIVE_ARCH=NO \ |
| 53 | + -allowProvisioningUpdates |
| 54 | +
|
| 55 | + - name: Export app |
| 56 | + run: | |
| 57 | + xcodebuild -exportArchive -archivePath "${{ env.projname }}.xcarchive" -exportPath Release -exportOptionsPlist ".github/exportOptions.plist" |
| 58 | + |
| 59 | + # Rename exported app to "Mew Notch.app" for DMG |
| 60 | + mv "Release/MewNotch.app" "Release/Mew Notch.app" |
| 61 | +
|
| 62 | + - name: Create DMG |
| 63 | + run: | |
| 64 | + create-dmg \ |
| 65 | + --volname "MewNotch Installer" \ |
| 66 | + --volicon "MewNotch/Resources/Assets/MewAssets.xcassets/AppIcon.appiconset/MewNotch-1024.png" \ |
| 67 | + --window-pos 200 120 \ |
| 68 | + --window-size 800 400 \ |
| 69 | + --background ".github/res/Installer-Background.png" \ |
| 70 | + --icon-size 128 \ |
| 71 | + --icon "Mew Notch.app" 200 185 \ |
| 72 | + --hide-extension "Mew Notch.app" \ |
| 73 | + --app-drop-link 600 185 \ |
| 74 | + "MewNotch-${{ github.ref_name }}.dmg" \ |
| 75 | + "Release/Mew Notch.app" |
| 76 | +
|
| 77 | + - name: Upload Release Asset |
| 78 | + uses: actions/upload-release-asset@v1 |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + with: |
| 82 | + upload_url: ${{ github.event.release.upload_url }} |
| 83 | + asset_path: ./MewNotch-${{ github.ref_name }}.dmg |
| 84 | + asset_name: MewNotch-${{ github.ref_name }}.dmg |
| 85 | + asset_content_type: application/x-apple-diskimage |
0 commit comments