diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e9e6200..3203baa3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,16 @@ -version: 2 +version: 2.1 jobs: - build: + build_android: docker: - image: vhanda/flutter-android:latest steps: - checkout - run: - name: Setup Flutter Env + name: Setup GitJournal Build Env command: /opt/flutter/bin/cache/dart-sdk/bin/dart ./scripts/setup_env.dart - run: name: SSH Problem command: echo 'Host *\n StrictHostKeyChecking no' > ~/.ssh/config - - run: - name: Current Directory - command: pwd - - run: - name: List Directory - command: ls -l - run: name: Test command: flutter test -j 1 --coverage --machine | tojunit --output junit.xml @@ -51,3 +45,37 @@ jobs: - run: name: Publish Alpha command: cd android && fastlane alphaBuild + build_ios: + macos: + xcode: 11.3.1 + steps: + - checkout + - run: + name: Install gpg + command: brew install gnupg git-crypt md5sha1sum wget + - run: + name: Install Flutter + command: ./scripts/ios_install_flutter.sh + - run: + name: Setup Environment Variables + command: | + echo "export PATH=flutter/bin:$PATH" >> $BASH_ENV + - run: + name: Unlock Secrets + command: ./scripts/decrypt_secrets.sh + - run: + name: Setup GitJournal Build Env + command: ./flutter/bin/cache/dart-sdk/bin/dart ./scripts/setup_env.dart + - run: + name: Setup provisioning profile + command: ./scripts/add_ios_keys.sh + - run: + name: Build App + command: ./scripts/build_ios.sh + +workflows: + version: 2 + build_all: + jobs: + - build_android + - build_ios diff --git a/ios/keys/fastlane_password b/ios/keys/fastlane_password new file mode 100644 index 00000000..037f534b Binary files /dev/null and b/ios/keys/fastlane_password differ diff --git a/scripts/build_ios.sh b/scripts/build_ios.sh index 757bd1eb..7dfc5d7f 100755 --- a/scripts/build_ios.sh +++ b/scripts/build_ios.sh @@ -1,10 +1,5 @@ #!/usr/bin/env bash -if [ -z ${FASTLANE_PASSWORD+x} ]; then - echo "Must set FASTLANE_PASSWORD" - exit 1 -fi - set -eo pipefail cd "$(dirname "$0")" @@ -18,6 +13,8 @@ if [[ $(git status -s | grep -v '??') ]]; then exit 1 fi +flutter pub get + # Download the required libraries export LIBS_URL="https://github.com/GitJournal/ios-libraries/releases/download/v1.1/libs.zip" @@ -43,7 +40,9 @@ echo "Build Number: $BUILD_NUM" BUILD_NAME=$(cat pubspec.yaml | grep version | awk '{ print $2 }' | awk -F "+" '{ print $1 }') echo "Build Name: $BUILD_NAME" -flutter build ios --release --no-codesign --build-number=$BUILD_NUM --build-name=$BUILD_NAME +flutter build ios --release --no-codesign --build-number="$BUILD_NUM" --build-name="$BUILD_NAME" cd ios + +export FASTLANE_PASSWORD=$(cat keys/fastlane_password) bundle exec fastlane release diff --git a/scripts/ios_install_flutter.sh b/scripts/ios_install_flutter.sh new file mode 100755 index 00000000..80702e21 --- /dev/null +++ b/scripts/ios_install_flutter.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -eux + +wget https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_1.22.4-stable.zip +unzip flutter_macos_1.22.4-stable.zip +export PATH="$PATH:$(pwd)/flutter/bin" + +flutter precache +flutter doctor