Files
warmbly/.github/workflows/ios-release.yml
T

101 lines
3.5 KiB
YAML

name: iOS release
# Every merge to main that touches the app becomes a TestFlight build. Moving a
# build to the App Store is a separate, manual step in App Store Connect.
on:
push:
branches: [main]
paths:
- "ios/**"
- ".github/workflows/ios-release.yml"
workflow_dispatch:
# Builds are numbered by run, so two uploads must not race each other.
concurrency:
group: ios-release
cancel-in-progress: false
permissions:
contents: read
jobs:
testflight:
name: TestFlight
# Forks hold no signing key; only the upstream repository uploads.
if: github.repository == 'warmbly/warmbly'
runs-on: macos-26
timeout-minutes: 45
environment: app-store
env:
APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
steps:
- uses: actions/checkout@v4
- name: Select newest Xcode
run: |
sudo xcode-select -s "$(ls -d /Applications/Xcode*.app | sort -V | tail -1)"
xcodebuild -version
- name: Check configuration
env:
ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 }}
run: |
missing=""
[ -n "$APPLE_TEAM_ID" ] || missing="$missing APPLE_TEAM_ID(variable)"
[ -n "$ASC_KEY_ID" ] || missing="$missing ASC_KEY_ID"
[ -n "$ASC_ISSUER_ID" ] || missing="$missing ASC_ISSUER_ID"
[ -n "$ASC_KEY_P8" ] || missing="$missing ASC_KEY_P8"
if [ -n "$missing" ]; then
echo "::error::The app-store environment is missing:$missing (see ios/DEVELOPMENT.md)"
exit 1
fi
- name: Write the App Store Connect key
env:
ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 }}
run: |
umask 077
key="$RUNNER_TEMP/AuthKey_${ASC_KEY_ID}.p8"
printf '%s' "$ASC_KEY_P8" | base64 --decode > "$key"
echo "ASC_KEY_PATH=$key" >> "$GITHUB_ENV"
echo "ARCHIVE=$RUNNER_TEMP/Warmbly.xcarchive" >> "$GITHUB_ENV"
- name: Archive
run: |
set -o pipefail
xcodebuild archive \
-project ios/Warmbly.xcodeproj \
-scheme Warmbly \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath "$ARCHIVE" \
-allowProvisioningUpdates \
-authenticationKeyPath "$ASC_KEY_PATH" \
-authenticationKeyID "$ASC_KEY_ID" \
-authenticationKeyIssuerID "$ASC_ISSUER_ID" \
DEVELOPMENT_TEAM="$APPLE_TEAM_ID" \
CURRENT_PROJECT_VERSION="${{ github.run_number }}"
- name: Upload to TestFlight
run: |
set -o pipefail
options="$RUNNER_TEMP/ExportOptions.plist"
cp ios/release/ExportOptions.plist "$options"
plutil -replace teamID -string "$APPLE_TEAM_ID" "$options"
xcodebuild -exportArchive \
-archivePath "$ARCHIVE" \
-exportOptionsPlist "$options" \
-exportPath "$RUNNER_TEMP/export" \
-allowProvisioningUpdates \
-authenticationKeyPath "$ASC_KEY_PATH" \
-authenticationKeyID "$ASC_KEY_ID" \
-authenticationKeyIssuerID "$ASC_ISSUER_ID"
version=$(/usr/libexec/PlistBuddy -c 'Print :ApplicationProperties:CFBundleShortVersionString' "$ARCHIVE/Info.plist")
echo "Uploaded Warmbly $version (${{ github.run_number }}) to App Store Connect." >> "$GITHUB_STEP_SUMMARY"
- name: Remove the key
if: always()
run: rm -f "$RUNNER_TEMP"/AuthKey_*.p8