diff --git a/.github/project_workflows/automatic_pull_request_review.yml b/.github/project_workflows/automatic_pull_request_review.yml index 5c1910c4..da938f1b 100644 --- a/.github/project_workflows/automatic_pull_request_review.yml +++ b/.github/project_workflows/automatic_pull_request_review.yml @@ -11,7 +11,7 @@ concurrency: jobs: review_pull_request: name: Pull request review by Danger - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - uses: actions/checkout@v3 with: diff --git a/.github/project_workflows/deploy_app_store.yml b/.github/project_workflows/deploy_app_store.yml index a054675e..dffb4a86 100644 --- a/.github/project_workflows/deploy_app_store.yml +++ b/.github/project_workflows/deploy_app_store.yml @@ -33,7 +33,7 @@ jobs: build: name: Build - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - name: Checkout Repo uses: actions/checkout@v3 diff --git a/.github/project_workflows/deploy_production_firebase.yml b/.github/project_workflows/deploy_production_firebase.yml index ad71aed9..5e00b761 100644 --- a/.github/project_workflows/deploy_production_firebase.yml +++ b/.github/project_workflows/deploy_production_firebase.yml @@ -31,7 +31,7 @@ jobs: build: name: Build - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - uses: actions/checkout@v3 # Set fetch-depth (default: 1) to get whole tree diff --git a/.github/project_workflows/deploy_staging_firebase.yml b/.github/project_workflows/deploy_staging_firebase.yml index fff0630a..4e0d5d53 100644 --- a/.github/project_workflows/deploy_staging_firebase.yml +++ b/.github/project_workflows/deploy_staging_firebase.yml @@ -31,7 +31,7 @@ jobs: build: name: Build - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - uses: actions/checkout@v3 # Set fetch-depth (default: 1) to get whole tree diff --git a/.github/workflows/test_uikit_install_script.yml b/.github/workflows/test_uikit_install_script.yml index 3f4d0a60..8b723006 100644 --- a/.github/workflows/test_uikit_install_script.yml +++ b/.github/workflows/test_uikit_install_script.yml @@ -11,7 +11,7 @@ concurrency: jobs: Test: name: Test - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test_upload_build_to_firebase.yml b/.github/workflows/test_upload_build_to_firebase.yml index 8b0becfc..f8d6c1f4 100644 --- a/.github/workflows/test_upload_build_to_firebase.yml +++ b/.github/workflows/test_upload_build_to_firebase.yml @@ -17,7 +17,7 @@ concurrency: jobs: build: name: Build - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - name: Checkout Repo uses: actions/checkout@v3 diff --git a/.github/workflows/test_upload_build_to_test_flight.yml b/.github/workflows/test_upload_build_to_test_flight.yml index 9d68acba..08db64a2 100644 --- a/.github/workflows/test_upload_build_to_test_flight.yml +++ b/.github/workflows/test_upload_build_to_test_flight.yml @@ -19,7 +19,7 @@ concurrency: jobs: build: name: Build - runs-on: macOS-latest + runs-on: {RUNNER_TYPE} steps: - name: Checkout Repo uses: actions/checkout@v3 diff --git a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift index 06436a46..0110152c 100644 --- a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift +++ b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift @@ -22,6 +22,7 @@ struct SetUpCICDService { } } + private let CONSTANT_RUNNER_TYPE = "{RUNNER_TYPE}" private let fileManager = FileManager.default func perform() { @@ -40,6 +41,30 @@ struct SetUpCICDService { fileManager.createDirectory(path: ".github/workflows") fileManager.moveFiles(in: ".github/project_workflows", to: ".github/workflows") fileManager.removeItems(in: ".github/project_workflows") + fileManager.moveFiles(in: ".github/project_workflows", to: ".github/workflows") + fileManager.removeItems(in: ".github/project_workflows") + + var runnerType: String? + var runnerName: String = "" + while runnerType == nil { + print("Which workflow runner do you want to use? [(m)acos-latest/(s)elf-hosted]: ") + runnerType = readLine()?.lowercased() + if runnerType != "m" && runnerType != "s" { + print("Invalid input. Please enter 'm' for macOS-latest or 's' for self-hosted.") + runnerType = nil + } + } + + // Use the selected runnerType to configure the workflow + if runnerType == "s" { + print("Configuring workflow for self-hosted runner") + runnerName = "[self-hosted, macOS]" + } else { + print("Configuring workflow for macOS-latest") + runnerName = "macOS-latest" + } + + fileManager.replaceAllOccurrences(of: CONSTANT_RUNNER_TYPE, to: runnerName) case .bitrise: print("Setting template for Bitrise") fileManager.removeItems(in: "codemagic.yaml")