Skip to content

v0.12.4

v0.12.4 #70

Workflow file for this run

name: 🚀 Release iOS App
on:
release:
types: [published]
jobs:
build-and-deploy-ios:
name: 🏗️ Build and Deploy iOS App to App Store
runs-on: macos-15
steps:
- name: 📂 Checkout code
uses: actions/checkout@v5
- name: 🚀 Cache pub deps
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-
- name: 🔧 Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.4'
- name: 📱 Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.3'
channel: 'stable'
cache: true
- name: 📦 Install dependencies
run: flutter pub get
- name: 📋 Get version from pubspec
id: version
run: |
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: 🔑 Setup iOS Code Signing
run: |
echo "${{ secrets.DIS_CERTIFICATE_BASE64 }}" | base64 -D > dist_cert.p12
echo "${{ secrets.PROVISIONING_PROFILE }}" | base64 -D > dist_profile.mobileprovision
security create-keychain -p "" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "" build.keychain
security import dist_cert.p12 -k build.keychain -P "${{ secrets.DIS_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "" build.keychain
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp dist_profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
# Find UUID of the provisioning profile
PP_UUID=$(/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< "$(security cms -D -i dist_profile.mobileprovision)")
echo "Provisioning Profile UUID: $PP_UUID"
- name: 🛠️ Build Flutter iOS App (no codesign)
run: flutter build ios --release --no-codesign --build-number=${{ github.run_number }}
- name: 🔧 Patch Podfile for CI signing
run: |
# Füge Ruby-Code-Block zum Podfile hinzu, falls noch nicht vorhanden
if ! grep -q "post_install do |installer|" ios/Podfile; then
echo -e '\npost_install do |installer|\nend' >> ios/Podfile
fi
# Füge die Signierungs-Settings für alle Pods ein
sed -i '' '/post_install do |installer|/a\
installer.pods_project.targets.each do |target|\
target.build_configurations.each do |config|\
config.build_settings["CODE_SIGNING_ALLOWED"] = "NO"\
config.build_settings["CODE_SIGNING_REQUIRED"] = "NO"\
config.build_settings["CODE_SIGN_STYLE"] = "Automatic"\
config.build_settings["PROVISIONING_PROFILE_SPECIFIER"] = ""\
config.build_settings["DEVELOPMENT_TEAM"] = ""\
end\
end
' ios/Podfile
cd ios
pod install
cd ..
- name: 📝 Create CI signing config
run: |
cat > ios/ci-signing.xcconfig <<EOF
CODE_SIGN_STYLE = Manual
DEVELOPMENT_TEAM = ${{ secrets.APPLE_TEAM_ID }}
PROVISIONING_PROFILE_SPECIFIER = ${{ secrets.PROFILE_NAME }}
CODE_SIGN_IDENTITY = Apple Distribution
OTHER_CODE_SIGN_FLAGS = --keychain build.keychain
EOF
- name: 🏗️ Archive iOS App
run: |
cd ios
xcodebuild \
-workspace Runner.xcworkspace \
-scheme Runner \
-configuration Release \
-archivePath ../build/Runner.xcarchive \
-xcconfig ci-signing.xcconfig \
archive
- name: 📝 Generate ExportOptions.plist
run: |
echo '{
"method": "app-store",
"teamID": "${{ secrets.APPLE_TEAM_ID }}",
"signingStyle": "manual",
"provisioningProfiles": {
"io.scelus.dienstplan": "${{ secrets.PROFILE_NAME }}"
}
}' > ios/ExportOptions.json
plutil -convert xml1 -o ios/ExportOptions.plist ios/ExportOptions.json
ls -l ios/ExportOptions.plist
cat ios/ExportOptions.plist
- name: 📦 Export IPA
run: |
xcodebuild -exportArchive \
-archivePath build/Runner.xcarchive \
-exportOptionsPlist ios/ExportOptions.plist \
-exportPath build/export
- name: 🔍 Find exported IPA
id: find_ipa
run: |
find build/export -type f -name "*.ipa" | head -1 > ipa_path.txt
IPA_PATH=$(cat ipa_path.txt)
echo "IPA_PATH=$IPA_PATH" >> $GITHUB_ENV
- name: 📛 Rename IPA for Release Asset
run: |
NEW_NAME="dienstplan-${{ github.event.release.tag_name }}-${{ github.run_number }}.ipa"
mv "$IPA_PATH" "build/export/$NEW_NAME"
echo "IPA_PATH=build/export/$NEW_NAME" >> $GITHUB_ENV
- name: ⬆️ Upload IPA to Existing Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.IPA_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 🔧 Install Codemagic CLI Tools (app-store-connect)
run: |
pip3 install --break-system-packages codemagic-cli-tools
which app-store-connect
app-store-connect --version
- name: 🏪 Deploy to App Store Connect
env:
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APPSTORE_CONNECT_KEY_IDENTIFIER }}
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
IPA_PATH: ${{ env.IPA_PATH }}
run: |
set -x
which app-store-connect
app-store-connect --version
if [ -f "${IPA_PATH}" ]; then
echo "✅ IPA file found: ${IPA_PATH}"
ls -la "${IPA_PATH}"
else
echo "❌ IPA file not found: ${IPA_PATH}"
find build/export
exit 1
fi
app-store-connect publish --path "${IPA_PATH}" || {
echo "❌ App Store Connect publish failed with code $?"
exit 1
}
echo "✅ App Store Connect deployment completed"
- name: 🧹 Cleanup
run: |
rm -f dist_cert.p12
rm -f dist_profile.mobileprovision
rm -rf build/
security delete-keychain build.keychain