|
| 1 | +name: Build and Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + name: Build macOS App |
| 15 | + runs-on: macos-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Select Xcode version |
| 22 | + run: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer |
| 23 | + |
| 24 | + - name: Show Xcode version |
| 25 | + run: xcodebuild -version |
| 26 | + |
| 27 | + - name: Resolve Swift Package dependencies |
| 28 | + run: | |
| 29 | + xcodebuild -resolvePackageDependencies \ |
| 30 | + -project "SerpApi Vision.xcodeproj" \ |
| 31 | + -scheme "SerpApi Vision" |
| 32 | + |
| 33 | + - name: Build application |
| 34 | + run: | |
| 35 | + xcodebuild clean build \ |
| 36 | + -project "SerpApi Vision.xcodeproj" \ |
| 37 | + -scheme "SerpApi Vision" \ |
| 38 | + -configuration Release \ |
| 39 | + -derivedDataPath build \ |
| 40 | + CODE_SIGN_IDENTITY="" \ |
| 41 | + CODE_SIGNING_REQUIRED=NO \ |
| 42 | + CODE_SIGNING_ALLOWED=NO |
| 43 | + |
| 44 | + - name: Create DMG |
| 45 | + run: | |
| 46 | + APP_NAME="SerpApi Vision" |
| 47 | + VERSION="1.0" |
| 48 | + BUILD_DIR="build" |
| 49 | + RELEASE_APP="$BUILD_DIR/Build/Products/Release/$APP_NAME.app" |
| 50 | + DMG_NAME="$APP_NAME-$VERSION.dmg" |
| 51 | + STAGING_DIR="$BUILD_DIR/staging" |
| 52 | + |
| 53 | + # Create staging directory |
| 54 | + mkdir -p "$STAGING_DIR" |
| 55 | + |
| 56 | + # Copy app to staging |
| 57 | + cp -R "$RELEASE_APP" "$STAGING_DIR" |
| 58 | + |
| 59 | + # Add symlink to Applications |
| 60 | + ln -s /Applications "$STAGING_DIR/Applications" |
| 61 | + |
| 62 | + # Create DMG |
| 63 | + hdiutil create -volname "$APP_NAME $VERSION" \ |
| 64 | + -srcfolder "$STAGING_DIR" \ |
| 65 | + -ov -format UDZO \ |
| 66 | + "$BUILD_DIR/$DMG_NAME" |
| 67 | + |
| 68 | + echo "DMG created at $BUILD_DIR/$DMG_NAME" |
| 69 | + |
| 70 | + - name: Upload DMG artifact |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: SerpApi-Vision-DMG |
| 74 | + path: build/SerpApi Vision-*.dmg |
| 75 | + retention-days: 30 |
| 76 | + |
| 77 | + - name: Upload App artifact |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: SerpApi-Vision-App |
| 81 | + path: build/Build/Products/Release/SerpApi Vision.app |
| 82 | + retention-days: 30 |
| 83 | + |
0 commit comments