Build Unsigned IPA #49
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 Unsigned IPA | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'project.yml' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version label (defaults to project.yml MARKETING_VERSION)' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: macos-26 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 2 | |
| - name: Check version change | |
| id: version_check | |
| run: | | |
| # Get version from project.yml | |
| VERSION=$(grep 'MARKETING_VERSION:' project.yml | head -1 | awk '{print $2}') | |
| echo "Current version: $VERSION" | |
| # Check if tag already exists | |
| if git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; then | |
| echo "Tag v${VERSION} already exists, skipping" | |
| echo "should_build=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "New version detected: $VERSION" | |
| echo "should_build=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Determine version | |
| id: version | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| if [[ -n "${{ inputs.version }}" ]]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION="${{ steps.version_check.outputs.version }}" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Version: $VERSION" | |
| - name: Install dependencies | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| brew tap FelixHerrmann/tap | |
| brew install xcodegen swiftgen swift-package-list | |
| - name: Generate Xcode project | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: xcodegen generate | |
| - name: Update acknowledgements | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| mkdir -p PocketMesh.xcodeproj/project.xcworkspace/xcshareddata/swiftpm | |
| xcodebuild -resolvePackageDependencies -project PocketMesh.xcodeproj -clonedSourcePackagesDirPath ./SourcePackages | |
| swift-package-list PocketMesh.xcodeproj --custom-source-packages-path ./SourcePackages --output-type settings-bundle --requires-license --output-path PocketMesh | |
| rm -rf SourcePackages | |
| - name: Build Debug | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| xcodebuild build \ | |
| -scheme PocketMesh \ | |
| -configuration Debug \ | |
| -destination "generic/platform=iOS" \ | |
| -derivedDataPath ./DerivedData \ | |
| CODE_SIGN_IDENTITY="-" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO | |
| - name: Build Release | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| xcodebuild build \ | |
| -scheme PocketMesh \ | |
| -configuration Release \ | |
| -destination "generic/platform=iOS" \ | |
| -derivedDataPath ./DerivedData \ | |
| CODE_SIGN_IDENTITY="-" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO | |
| - name: Package Debug IPA | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| mkdir -p Payload | |
| cp -r DerivedData/Build/Products/Debug-iphoneos/PocketMesh.app Payload/ | |
| zip -r "PocketMesh-Debug-${{ steps.version.outputs.version }}.ipa" Payload | |
| rm -rf Payload | |
| - name: Package Release IPA | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| mkdir -p Payload | |
| cp -r DerivedData/Build/Products/Release-iphoneos/PocketMesh.app Payload/ | |
| zip -r "PocketMesh-Release-${{ steps.version.outputs.version }}.ipa" Payload | |
| rm -rf Payload | |
| - name: Upload Debug IPA | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PocketMesh-Debug-${{ steps.version.outputs.version }} | |
| path: PocketMesh-Debug-${{ steps.version.outputs.version }}.ipa | |
| - name: Upload Release IPA | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PocketMesh-Release-${{ steps.version.outputs.version }} | |
| path: PocketMesh-Release-${{ steps.version.outputs.version }}.ipa | |
| - name: Create tag | |
| if: steps.version_check.outputs.should_build == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" | |
| - name: Create Draft Release | |
| if: steps.version_check.outputs.should_build == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| draft: true | |
| name: PocketMesh ${{ steps.version.outputs.version }} | |
| files: | | |
| PocketMesh-Debug-${{ steps.version.outputs.version }}.ipa | |
| PocketMesh-Release-${{ steps.version.outputs.version }}.ipa |