文件

111 行
3.4 KiB
YAML

name: Build iOS IPA
on:
push:
branches: [main]
workflow_dispatch:
inputs:
configuration:
description: 'Build configuration'
required: true
default: 'debug'
type: choice
options: ['debug', 'release']
jobs:
build:
name: Build IPA
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Xcode version
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Show Xcode version
run: xcodebuild -version
- name: Show build settings
run: |
xcodebuild -project AreYouSleeping.xcodeproj \
-scheme AreYouSleeping \
-showBuildSettings \
-destination 'generic/platform=iOS'
- name: Set build number
run: |
BUILD_NUM=${{ github.run_number }}
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NUM}" AreYouSleeping/Info.plist
- name: Build archive
run: |
xcodebuild archive \
-project AreYouSleeping.xcodeproj \
-scheme AreYouSleeping \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath build/AreYouSleeping.xcarchive \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY="" | xcpretty
- name: Package IPA
run: |
mkdir -p build/Payload
cp -R build/AreYouSleeping.xcarchive/Products/Applications/AreYouSleeping.app build/Payload/
cd build
zip -r AreYouSleeping.ipa Payload
cd ..
- name: Upload IPA artifact
uses: actions/upload-artifact@v4
with:
name: AreYouSleeping-${{ github.run_number }}.ipa
path: build/AreYouSleeping.ipa
retention-days: 30
- name: Generate install manifest
run: |
cat > build/manifest.plist << 'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>__IPA_URL__</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.ausleep.ios</string>
<key>bundle-version</key>
<string>${{ github.run_number }}</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>睡了吗</string>
</dict>
</dict>
</array>
</dict>
</plist>
PLIST
- name: Upload manifest
uses: actions/upload-artifact@v4
with:
name: OTA-manifest
path: build/manifest.plist
retention-days: 30