From 370f7971da44a7673bdd162fdcd6e9d00fb64569 Mon Sep 17 00:00:00 2001 From: ogulcan keskin Date: Tue, 19 Mar 2024 00:18:43 +0300 Subject: [PATCH] hi again --- .github/workflows/cd.yml | 38 ++++++++++ .github/workflows/pullRequest.yml | 34 --------- Fastlane/.env.local | 30 ++++++++ Fastlane/Appfile | 12 ++-- Fastlane/Fastfile | 114 +++++++++++++++++++----------- 5 files changed, 146 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/cd.yml delete mode 100644 .github/workflows/pullRequest.yml create mode 100644 Fastlane/.env.local diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..56c2413 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,38 @@ +name: CD +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions a tab + workflow_dispatch: + +jobs: + deploy: + name: Deploying to Testflight + runs-on: macOS-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v1 + + - name: Deploy iOS Beta to TestFlight via Fastlane + uses: maierj/fastlane-action@v1.4.0 + with: + lane: closed_beta + env: + APP_STORE_CONNECT_TEAM_ID: '${{ secrets.APP_STORE_CONNECT_TEAM_ID }}' + DEVELOPER_APP_ID: '${{ secrets.DEVELOPER_APP_ID }}' + DEVELOPER_APP_IDENTIFIER: '${{ secrets.DEVELOPER_APP_IDENTIFIER }}' + DEVELOPER_PORTAL_TEAM_ID: '${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}' + FASTLANE_APPLE_ID: '${{ secrets.FASTLANE_APPLE_ID }}' + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: '${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}' + MATCH_PASSWORD: '${{ secrets.MATCH_PASSWORD }}' + GIT_AUTHORIZATION: '${{ secrets.GIT_AUTHORIZATION }}' + PROVISIONING_PROFILE_SPECIFIER: '${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}' + TEMP_KEYCHAIN_PASSWORD: '${{ secrets.TEMP_KEYCHAIN_PASSWORD }}' + TEMP_KEYCHAIN_USER: '${{ secrets.TEMP_KEYCHAIN_USER }}' + APPLE_KEY_ID: '${{ secrets.APPLE_KEY_ID }}' + APPLE_ISSUER_ID: '${{ secrets.APPLE_ISSUER_ID }}' + APPLE_KEY_CONTENT: '${{ secrets.APPLE_KEY_CONTENT }}' \ No newline at end of file diff --git a/.github/workflows/pullRequest.yml b/.github/workflows/pullRequest.yml deleted file mode 100644 index e89f850..0000000 --- a/.github/workflows/pullRequest.yml +++ /dev/null @@ -1,34 +0,0 @@ -run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} - -on: - pull_request: - branches: - - development - workflow_dispatch: - -jobs: - build: - runs-on: macos-13 - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '15.0-beta' - - - uses: actions/checkout@v2 - - - uses: ruby/setup-ruby@v1 - - - name: Install Bundler - run: gem install bundler - - - name: Install gems - run: bundle install - - - name: Build and Upload to Testflight - run: bundle exec fastlane runTestFlight - env: - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} - - - diff --git a/Fastlane/.env.local b/Fastlane/.env.local new file mode 100644 index 0000000..431c4d9 --- /dev/null +++ b/Fastlane/.env.local @@ -0,0 +1,30 @@ +MATCH_PASSWORD = "123456" +username = "ogulcankeskin93" +MATCH_GIT_BASIC_AUTHORIZATION = "Z2hwX2plTXFnUTZWUXlSTUJDbjR3RURKZUhOelZKSG1kSDMxdldJaw==" + + +APPLE_KEY_ID="Y59CN6MQY6" +APPLE_ISSUER_ID="ee796e73-a95d-4683-beb5-0d6594a0c176" +APPLE_KEY_CONTENT="-----BEGIN PRIVATE KEY----- +xxxxxxxxxxxxxxxxxx +-----END PRIVATE KEY-----" +APP_STORE_CONNECT_TEAM_ID="124242512" +DEVELOPER_APP_ID="xxxxxxxxx" +DEVELOPER_APP_IDENTIFIER="com.deneyehayir.deneysiz" +DEVELOPER_PORTAL_TEAM_ID="B9YVSAL4BY" +FASTLANE_APPLE_ID="info@deneyehayir.org" +MATCH_PASSWORD="123456" +PROVISIONING_PROFILE_SPECIFIER="xxxxxxxxxxxxxx" +TEMP_KEYCHAIN_PASSWORD="xxxxxxx" +TEMP_KEYCHAIN_USER="xxxxxxx" +GIT_AUTHORIZATION="xxxxxxxxxxxxx" + + +app_identifier("com.deneyehayir.deneysiz") # The bundle identifier of your app +apple_id("info@deneyehayir.org") # Your Apple Developer Portal username + +itc_team_id("124242512") # App Store Connect Team ID +team_id("B9YVSAL4BY") # Developer Portal Team ID + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/Fastlane/Appfile b/Fastlane/Appfile index 068947b..d80f88e 100644 --- a/Fastlane/Appfile +++ b/Fastlane/Appfile @@ -1,8 +1,4 @@ -app_identifier("com.deneyehayir.deneysiz") # The bundle identifier of your app -apple_id("info@deneyehayir.org") # Your Apple Developer Portal username - -itc_team_id("124242512") # App Store Connect Team ID -team_id("B9YVSAL4BY") # Developer Portal Team ID - -# For more information about the Appfile, see: -# https://docs.fastlane.tools/advanced/#appfile +app_identifier(ENV["DEVELOPER_APP_IDENTIFIER"]) +apple_id(ENV["FASTLANE_APPLE_ID"]) +itc_team_id(ENV["APP_STORE_CONNECT_TEAM_ID"]) +team_id(ENV["DEVELOPER_PORTAL_TEAM_ID"]) \ No newline at end of file diff --git a/Fastlane/Fastfile b/Fastlane/Fastfile index a06b116..690f6ed 100644 --- a/Fastlane/Fastfile +++ b/Fastlane/Fastfile @@ -1,53 +1,87 @@ -# This file contains the fastlane.tools configuration -# You can find the documentation at https://docs.fastlane.tools -# -# For a list of all available actions, check out -# -# https://docs.fastlane.tools/actions -# -# For a list of all available plugins, check out -# -# https://docs.fastlane.tools/plugins/available-plugins -# - -# Uncomment the line if you want fastlane to automatically update itself -# update_fastlane - default_platform(:ios) -ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "300" +DEVELOPER_APP_ID = ENV["DEVELOPER_APP_ID"] +DEVELOPER_APP_IDENTIFIER = ENV["DEVELOPER_APP_IDENTIFIER"] +PROVISIONING_PROFILE_SPECIFIER = ENV["PROVISIONING_PROFILE_SPECIFIER"] +TEMP_KEYCHAIN_USER = ENV["TEMP_KEYCHAIN_USER"] +TEMP_KEYCHAIN_PASSWORD = ENV["TEMP_KEYCHAIN_PASSWORD"] +APPLE_ISSUER_ID = ENV["APPLE_ISSUER_ID"] +APPLE_KEY_ID = ENV["APPLE_KEY_ID"] +APPLE_KEY_CONTENT = ENV["APPLE_KEY_CONTENT"] +GIT_AUTHORIZATION = ENV["GIT_AUTHORIZATION"] + +def delete_temp_keychain(name) + delete_keychain( + name: name + ) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db") +end + +def create_temp_keychain(name, password) + create_keychain( + name: name, + password: password, + unlock: false, + timeout: 0 + ) +end + +def ensure_temp_keychain(name, password) + delete_temp_keychain(name) + create_temp_keychain(name, password) +end platform :ios do - desc "Push a new beta build to TestFlight" - lane :beta do + lane :closed_beta do + keychain_name = TEMP_KEYCHAIN_USER + keychain_password = TEMP_KEYCHAIN_PASSWORD + ensure_temp_keychain(keychain_name, keychain_password) + + api_key = app_store_connect_api_key( + key_id: APPLE_KEY_ID, + issuer_id: APPLE_ISSUER_ID, + key_content: APPLE_KEY_CONTENT, + duration: 1200, + in_house: false + ) + increment_build_number(xcodeproj: "Deneysiz.xcodeproj") - build_app(scheme: "Deneysiz") - upload_to_testflight - end + + cocoapods( + clean_install: true + ) - desc 'Builds project and executes unit tests' - lane :unit_test do |options| - scan( - clean: options[:clean], - skip_package_dependencies_resolution: options[:skip_package_dependencies_resolution] - ) - end + match( + type: 'appstore', + app_identifier: "#{DEVELOPER_APP_IDENTIFIER}", + git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION), + readonly: true, + keychain_name: keychain_name, + keychain_password: keychain_password, + api_key: api_key + ) - desc 'Running iOS tests using fastlane' - lane :tests do - run_tests( + gym( + configuration: "Release", workspace: "Deneysiz.xcodeproj/project.xcworkspace", scheme: "Deneysiz", - devices: ["iPhone 14"], - clean: true, - prelaunch_simulator: true, - result_bundle: true + export_method: "app-store", + export_options: { + provisioningProfiles: { + DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER + } + } + ) + + pilot( + apple_id: "#{DEVELOPER_APP_ID}", + app_identifier: "#{DEVELOPER_APP_IDENTIFIER}", + skip_waiting_for_build_processing: true, + skip_submission: true, + distribute_external: false, + notify_external_testers: false, + ipa: "./Deneysiz.ipa" ) - end - lane :runTestFlight do - setup_ci if ENV['CI'] - match(type: "appstore", readonly: true, git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"]) - build_app(clean: true, scheme: "Deneysiz") + delete_temp_keychain(keychain_name) end end \ No newline at end of file