-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kimmy214
committed
Oct 14, 2022
1 parent
550906d
commit 2c70dbb
Showing
3 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Release Flutter (iOS) | ||
on: | ||
# Enable manual run | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Tag to create (e.g. v2.10.0). Must include 'v' and must match pubspec" | ||
required: true | ||
default: "v2.10.0" | ||
type: string | ||
prerelease: | ||
description: "Prerelease" | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
jobs: | ||
macos-build: | ||
name: Create ios build | ||
runs-on: macos-latest | ||
env: | ||
SHEME: Runner | ||
BUILD_CONFIGURATION: Release | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: 'stable' | ||
|
||
- name: Flutter doctor -v | ||
run: flutter doctor -v | ||
|
||
- name: Install Deps | ||
run: flutter pub get | ||
|
||
- name: Install the Apple certificate and provisioning profile | ||
env: | ||
BUILD_CERTIFICATE_BASE64: ${{ secrets.P12_BASE64 }} | ||
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | ||
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }} | ||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | ||
run: | | ||
# create variables | ||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | ||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | ||
# import certificate and provisioning profile from secrets | ||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH | ||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH | ||
# create temporary keychain | ||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | ||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
# import certificate to keychain | ||
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security list-keychain -d user -s $KEYCHAIN_PATH | ||
# apply provisioning profile | ||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | ||
- name: Build | ||
run: flutter build ios --release --no-codesign --no-tree-shake-icons | ||
|
||
- name: Build resolve Swift dependencies | ||
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme ${{ env.SHEME }} -configuration ${{ env.BUILD_CONFIGURATION }} | ||
|
||
- name: Build xArchive | ||
run: | | ||
xcodebuild -workspace ios/Runner.xcworkspace -scheme ${{ env.SHEME }} -configuration ${{ env.BUILD_CONFIGURATION }} DEVELOPMENT_TEAM=${{ secrets.TEAM_ID }} -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE=${{ secrets.PROVISIONING_PROFILE }} clean archive CODE_SIGN_IDENTITY="${{ secrets.CODE_SIGN_IDENTITY }}" | ||
- name: Export ipa | ||
run: xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ios-artifact | ||
path: build-output/ios | ||
|
||
- name: Clean up keychain and provisioning profile | ||
if: ${{ always() }} | ||
run: | | ||
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db | ||
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision |
This file contains 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
This file contains 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