diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1679340 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +language: swift + +osx_image: xcode8.3 + +xcode_project: ci-sample.xcodeproj +xcode_scheme: ci-sample + +before_install: + - openssl aes-256-cbc -K $encrypted_448470aeb6e7_key -iv $encrypted_448470aeb6e7_iv -in ./travis/secrets.tar.enc -out ./travis/secrets.tar -d + - tar xvf ./travis/secrets.tar -C ./travis + - gem install xcpretty-travis-formatter --no-document + - bundle install --path ./vendor/bundle + +before_script: + - bundle exec fastlane setup_certificate + - mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + - cp ./travis/*mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/ + +script: + - bundle exec fastlane build + +after_success: + +after_script: + - security delete-keychain ios-build.keychain + - rm -f "~/Library/MobileDevice/Provisioning Profiles/" + +notifications: + email: false diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 99be57c..e67e4f1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -3,6 +3,8 @@ fastlane_version "2.53.1" default_platform :ios platform :ios do + keychain_name = "ios-build.keychain" + keychain_password = SecureRandom.base64 lane :build do clean_build_artifacts @@ -15,4 +17,22 @@ platform :ios do ) end + lane :setup_certificate do + create_keychain( + name: keychain_name, + password: keychain_password, + default_keychain: true, + unlock: true, + timeout: 3600, + add_to_search_list: true + ) + + import_certificate( + certificate_path: "travis/dist.p12", + certificate_password: ENV["KEY_PASSWORD"], + keychain_name: keychain_name, + keychain_password: keychain_password + ) + end + end diff --git a/travis.yml b/travis.yml deleted file mode 100644 index fe45009..0000000 --- a/travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -notifications: - email: false \ No newline at end of file diff --git a/travis/secrets.tar.enc b/travis/secrets.tar.enc new file mode 100644 index 0000000..f82204f Binary files /dev/null and b/travis/secrets.tar.enc differ