From 1fb8dc710da7ddb428d569a75f8844dc380d42a4 Mon Sep 17 00:00:00 2001 From: deltamaya Date: Mon, 28 Oct 2024 22:41:41 +0800 Subject: [PATCH 1/2] fix macos build action --- .github/workflows/main.yml | 129 +++++++++++++++++++++++++++---------- 1 file changed, 95 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7ad9bbf..7790608 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,40 +6,101 @@ jobs: Build_IOS: runs-on: macos-13 steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version-file: pubspec.yaml - architecture: x64 - - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app - - run: flutter pub get - - run: flutter build ios --release --no-codesign - - run: | - mkdir -p /Users/runner/work/venera/venera/build/ios/iphoneos/Payload - mv /Users/runner/work/venera/venera/build/ios/iphoneos/Runner.app /Users/runner/work/venera/venera/build/ios/iphoneos/Payload - cd /Users/runner/work/venera/venera/build/ios/iphoneos/ - zip -r venera-ios.ipa Payload - - uses: actions/upload-artifact@v4 - with: - name: app-ios.ipa - path: /Users/runner/work/venera/venera/build/ios/iphoneos/venera-ios.ipa + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version-file: pubspec.yaml + architecture: x64 + - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app + - run: flutter pub get + - run: flutter build ios --release --no-codesign + - run: | + mkdir -p /Users/runner/work/venera/venera/build/ios/iphoneos/Payload + mv /Users/runner/work/venera/venera/build/ios/iphoneos/Runner.app /Users/runner/work/venera/venera/build/ios/iphoneos/Payload + cd /Users/runner/work/venera/venera/build/ios/iphoneos/ + zip -r venera-ios.ipa Payload + - uses: actions/upload-artifact@v4 + with: + name: app-ios.ipa + path: /Users/runner/work/venera/venera/build/ios/iphoneos/venera-ios.ipa Build_MacOS: runs-on: macos-13 steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version-file: pubspec.yaml - architecture: x64 - - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app - - run: flutter pub get - - run: flutter build macos --release - - run: npm install --global create-dmg - - run: create-dmg 'build/macos/Build/Products/Release/venera.app' - - uses: actions/upload-artifact@v4 - with: - name: macos-dmg - path: build/macos/Build/Products/Release/*.dmg - \ No newline at end of file + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version-file: pubspec.yaml + architecture: x64 + - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app + - run: flutter pub get + - run: flutter build macos --release + # Step 1: Decode and install the certificate + - name: Decode and install certificate + env: + CERTIFICATE: ${{ secrets.CERTIFICATE }} + CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} + run: | + echo "$CERTIFICATE" | base64 --decode > signing_certificate.p12 + security import signing_certificate.p12 -k ~/Library/Keychains/login.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign + + # Step 2: Build the Flutter macOS app + - name: Build Flutter macOS App + run: flutter build macos --release + + # Step 3: Code-sign the app + - name: Code sign application + env: + APPLE_DEVELOPER_ID: ${{ secrets.APPLE_DEVELOPER_ID }} + run: | + codesign --deep --force --verbose --sign "$APPLE_DEVELOPER_ID" build/macos/Build/Products/Release/venera.app + + # Step 4: Create the DMG file + - name: Create DMG + run: | + mkdir -p dist + hdiutil create -volname "venera" -srcfolder build/macos/Build/Products/Release/venera.app -ov -format UDZO "dist/venera.dmg" + + # Step 5: Code-sign the DMG + - name: Code sign DMG + env: + APPLE_DEVELOPER_ID: ${{ secrets.APPLE_DEVELOPER_ID }} + run: | + codesign --force --sign "$APPLE_DEVELOPER_ID" dist/venera.dmg + + # Step 6: Notarize the DMG (optional but recommended for macOS Catalina and later) + - name: Notarize DMG + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APP_PASSWORD: ${{ secrets.APP_PASSWORD }} + run: | + xcrun altool --notarize-app -f dist/venera.dmg --primary-bundle-id "com.github.wgh136.venera" -u "$APPLE_ID" -p "$APP_PASSWORD" + + # Step 7: Wait for notarization (optional, if notarizing) + - name: Wait for notarization + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APP_PASSWORD: ${{ secrets.APP_PASSWORD }} + run: | + REQUEST_UUID=$(xcrun altool --notarization-info -u "$APPLE_ID" -p "$APP_PASSWORD" | grep "RequestUUID" | awk '{print $3}') + while true; do + STATUS=$(xcrun altool --notarization-info "$REQUEST_UUID" -u "$APPLE_ID" -p "$APP_PASSWORD" | grep "Status" | awk '{print $2}') + if [ "$STATUS" == "success" ]; then + echo "Notarization successful!" + break + elif [ "$STATUS" == "in progress" ]; then + echo "Notarization in progress..." + sleep 30 + else + echo "Notarization failed!" + exit 1 + fi + done + + # Step 8: Attach and upload artifacts (optional) + - name: Upload DMG + uses: actions/upload-artifact@v3 + with: + name: venera.dmg + path: dist/venera.dmg From cfd912b31bee54f871b1d4ab0d43d29d0c809049 Mon Sep 17 00:00:00 2001 From: deltamaya Date: Mon, 28 Oct 2024 22:56:06 +0800 Subject: [PATCH 2/2] macos build action --- .github/workflows/main.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7790608..6dd4958 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,35 +69,6 @@ jobs: run: | codesign --force --sign "$APPLE_DEVELOPER_ID" dist/venera.dmg - # Step 6: Notarize the DMG (optional but recommended for macOS Catalina and later) - - name: Notarize DMG - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APP_PASSWORD: ${{ secrets.APP_PASSWORD }} - run: | - xcrun altool --notarize-app -f dist/venera.dmg --primary-bundle-id "com.github.wgh136.venera" -u "$APPLE_ID" -p "$APP_PASSWORD" - - # Step 7: Wait for notarization (optional, if notarizing) - - name: Wait for notarization - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APP_PASSWORD: ${{ secrets.APP_PASSWORD }} - run: | - REQUEST_UUID=$(xcrun altool --notarization-info -u "$APPLE_ID" -p "$APP_PASSWORD" | grep "RequestUUID" | awk '{print $3}') - while true; do - STATUS=$(xcrun altool --notarization-info "$REQUEST_UUID" -u "$APPLE_ID" -p "$APP_PASSWORD" | grep "Status" | awk '{print $2}') - if [ "$STATUS" == "success" ]; then - echo "Notarization successful!" - break - elif [ "$STATUS" == "in progress" ]; then - echo "Notarization in progress..." - sleep 30 - else - echo "Notarization failed!" - exit 1 - fi - done - # Step 8: Attach and upload artifacts (optional) - name: Upload DMG uses: actions/upload-artifact@v3