Skip to content

.github/workflows/main.yml #25

.github/workflows/main.yml

.github/workflows/main.yml #25

Workflow file for this run

on:
workflow_dispatch:
inputs:
tag:
required: true
description: "Release tag (e.g. v0.6.0-3)"
jobs:
build_and_release:
name: Build and release iOS
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Locally clone pml-iOS Repository
run: git clone --branch ${{ github.event.inputs.tag }} --depth 1 https://git.polymodloader.com/Jakob/PolyModLoader.git www
- name: Patch PolyModLoader for iOS
if: false
run: bash scripts/patch-ios.sh
- name: Set up node.js
uses: actions/setup-node@v4
- name: Set up capacitor workspace
run: |
npm install
npx cap sync ios
cd ios/App
- name: Import signing certificate
env:
P12_BASE64: ${{ secrets.IOS_CERTIFICATE_P12_BASE64 }}
P12_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# Create a temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
# Import certificate
echo "$P12_BASE64" | base64 --decode > certificate.p12
security import certificate.p12 \
-k build.keychain \
-P "$P12_PASSWORD" \
-T /usr/bin/codesign
security set-key-partition-list \
-S apple-tool:,apple: \
-s -k "$KEYCHAIN_PASSWORD" build.keychain
# Install provisioning profile
echo "${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}" | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
- name: Set version from tag
run: |
TAG=${{ github.event.inputs.tag }}
# Strip the leading 'v' -> 0.6.0-3
VERSION=${TAG#v}
# Split on '-'
MARKETING_VERSION=${VERSION%-*}
BUILD_NUMBER=${VERSION##*-}
echo "MARKETING_VERSION=$MARKETING_VERSION" >> $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
- name: Compile iOS
run: |
xcodebuild \
-workspace ios/App/App.xcodeproj/project.xcworkspace \
-scheme App \
-sdk iphoneos \
-configuration Release \
-archivePath $RUNNER_TEMP/App.xcarchive \
MARKETING_VERSION=${{ env.MARKETING_VERSION }} \
CURRENT_PROJECT_VERSION=${{ env.BUILD_NUMBER }} \
archive \
CODE_SIGN_STYLE=Manual \
CODE_SIGN_IDENTITY="iPhone Distribution" \
PROVISIONING_PROFILE_SPECIFIER="Github actions PML build"
- name: Export IPA
run: |
xcodebuild \
-exportArchive \
-archivePath $RUNNER_TEMP/App.xcarchive \
-exportPath $RUNNER_TEMP/export \
-exportOptionsPlist ios/ExportOptions.plist
- name: List export directory
run: find $RUNNER_TEMP/export -type f
- name: Upload to TestFlight (temporarily disabled for testing)
if: false
env:
API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }}
API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
API_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }}
run: |
mkdir -p ~/.appstoreconnect/private_keys
echo "$API_KEY_BASE64" | base64 --decode > ~/.appstoreconnect/private_keys/AuthKey_${API_KEY_ID}.p8
# Find the actual IPA name
IPA_PATH=$(find $RUNNER_TEMP/export -name "*.ipa" | head -1)
echo "Found IPA: $IPA_PATH"
xcrun altool --upload-app \
-f "$IPA_PATH" \
-t ios \
--apiKey "$API_KEY_ID" \
--apiIssuer "$API_ISSUER_ID"
- name: Upload IPA artifact
uses: actions/upload-artifact@v4
with:
name: ios-ipa
path: ${{ runner.temp }}/export/App.ipa
retention-days: 1