This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Showing
1 changed file
with
102 additions
and
0 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,102 @@ | ||
name: Artifacts | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Flutter (.aab & .xarchive) | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Java 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11.x' | ||
|
||
- name: Install Flutter | ||
uses: subosito/flutter-action@v1 | ||
with: | ||
flutter-version: '2.2.3' | ||
|
||
- name: Android Config | ||
env: | ||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64}} | ||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | ||
PLAY_SERVICE_BASE64: ${{ secrets.PLAY_SERVICE_BASE64 }} | ||
GOOGLE_SERVICES_BASE64: ${{ secrets.GOOGLE_SERVICES_BASE64 }} | ||
run: | | ||
# create keystore | ||
echo -n "$KEYSTORE_BASE64" | base64 --decode --output android/android_signer.jks | ||
# build properties file | ||
printf 'storePassword=%s\nkeyPassword=%s\nkeyAlias=key\nstoreFile=../android_signer.jks' $KEYSTORE_PASSWORD $KEYSTORE_PASSWORD > android/keystore.properties | ||
# store play service json | ||
echo -n "$PLAY_SERVICE_BASE64" | base64 --decode --output android/play_service.json | ||
# store google services json | ||
echo -n "$GOOGLE_SERVICES_BASE64" | base64 --decode --output android/app/google-services.json | ||
- name: iOS Config | ||
env: | ||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | ||
DISTRIBUTE_CERTIFICATE_BASE64: ${{ secrets.DISTRIBUTE_CERTIFICATE_BASE64 }} | ||
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | ||
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | ||
DISTRIBUTE_PROVISION_PROFILE_BASE64: ${{ secrets.DISTRIBUTE_PROVISION_PROFILE_BASE64 }} | ||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | ||
GOOGLE_SERVICE_INFO_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_BASE64 }} | ||
run: | | ||
# create variables | ||
BUILD_CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
DISTRIBUTE_CERTIFICATE_PATH=$RUNNER_TEMP/distribute_certificate.p12 | ||
BUILD_PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | ||
DISTRIBUTE_PP_PATH=$RUNNER_TEMP/distribute_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 $BUILD_CERTIFICATE_PATH | ||
echo -n "$DISTRIBUTE_CERTIFICATE_BASE64" | base64 --decode --output $DISTRIBUTE_CERTIFICATE_PATH | ||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $BUILD_PP_PATH | ||
echo -n "$DISTRIBUTE_PROVISION_PROFILE_BASE64" | base64 --decode --output $DISTRIBUTE_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 $BUILD_CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security import $DISTRIBUTE_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 $BUILD_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $DISTRIBUTE_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | ||
# store google service info plist | ||
echo -n "$GOOGLE_SERVICE_INFO_BASE64" | base64 --decode --output ios/Runner/GoogleService-Info.plist | ||
- name: Flutter Dependencies | ||
run: | | ||
flutter pub get | ||
pod install --project-directory=ios/ | ||
- name: Build App Bundle (Android) | ||
run: flutter build appbundle --build-number=42$GITHUB_RUN_NUMBER | ||
|
||
- name: Build IPA (IOS) | ||
run: flutter build ipa --build-number=42$GITHUB_RUN_NUMBER | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "build/app/outputs/bundle/release/*.aab,build/ios/release/app.ipa" | ||
replacesArtifacts: false | ||
token: ${{ secrets.GH_TOKEN }} |