Use Node 24 GitHub actions #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Lookin Desktop | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Release build | |
| runs-on: macos-15 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| - name: Install CocoaPods | |
| run: gem install cocoapods -v 1.17.0 --no-document | |
| - name: Resolve dependencies | |
| run: pod install | |
| - name: Build universal Release app | |
| run: | | |
| set -euo pipefail | |
| xcodebuild \ | |
| -workspace Lookin.xcworkspace \ | |
| -scheme LookinClient \ | |
| -configuration Release \ | |
| -destination 'generic/platform=macOS' \ | |
| -derivedDataPath "$RUNNER_TEMP/LookinDerivedData" \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| ARCHS='arm64 x86_64' \ | |
| ONLY_ACTIVE_ARCH=NO \ | |
| build | |
| - name: Package app | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| set -euo pipefail | |
| app_path="$RUNNER_TEMP/LookinDerivedData/Build/Products/Release/Lookin.app" | |
| test -d "$app_path" | |
| codesign --force --deep --sign - "$app_path" | |
| codesign --verify --deep --strict "$app_path" | |
| lipo "$app_path/Contents/MacOS/Lookin" -verify_arch arm64 x86_64 | |
| ref_label="${GITHUB_REF_NAME//\//-}" | |
| artifact_name="Lookin-SwiftUI-Inspector-${ref_label}-${GITHUB_SHA:0:7}" | |
| artifact_dir="$GITHUB_WORKSPACE/dist" | |
| archive_path="$artifact_dir/${artifact_name}.zip" | |
| mkdir -p "$artifact_dir" | |
| ditto -c -k --sequesterRsrc --keepParent "$app_path" "$archive_path" | |
| cd "$artifact_dir" | |
| shasum -a 256 "${artifact_name}.zip" > "${artifact_name}.zip.sha256" | |
| - name: Upload packaged app | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: lookin-desktop-${{ github.run_id }} | |
| path: dist/* | |
| if-no-files-found: error | |
| retention-days: 14 | |
| release: | |
| name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download packaged app | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: lookin-desktop-${{ github.run_id }} | |
| path: dist | |
| - name: Create or update release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| archive_path="$(find dist -type f -name '*.zip' -print -quit)" | |
| test -n "$archive_path" | |
| checksum_path="${archive_path}.sha256" | |
| test -f "$checksum_path" | |
| if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| gh release upload "$GITHUB_REF_NAME" \ | |
| "$archive_path" \ | |
| "$checksum_path" \ | |
| --clobber \ | |
| --repo "$GITHUB_REPOSITORY" | |
| else | |
| gh release create "$GITHUB_REF_NAME" \ | |
| "$archive_path" \ | |
| "$checksum_path" \ | |
| --generate-notes \ | |
| --title "Lookin SwiftUI Inspector $GITHUB_REF_NAME" \ | |
| --repo "$GITHUB_REPOSITORY" | |
| fi |