From 3fcb78945e97b6622df72c9a7a1cea77c2d85279 Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Wed, 30 Aug 2023 18:31:56 +0700 Subject: [PATCH] [#495] Remove template workflows when using template --- .../automatic_pull_request_review.yml | 0 .../deploy_app_store.yml | 0 .../deploy_production_firebase.yml | 0 .../deploy_staging_firebase.yml | 0 .../draft_a_new_release.yml | 0 .../publish_docs_to_wiki.yml | 19 +++++++++++++++++++ .../Extensions/FileManager+Utils.swift | 9 +++++++-- .../iOSTemplateMaker/SetUpCICDService.swift | 4 ++++ .../iOSTemplateMaker/iOSTemplateMaker.swift | 2 +- 9 files changed, 31 insertions(+), 3 deletions(-) rename .github/{workflows => project_workflows}/automatic_pull_request_review.yml (100%) rename .github/{workflows => project_workflows}/deploy_app_store.yml (100%) rename .github/{workflows => project_workflows}/deploy_production_firebase.yml (100%) rename .github/{workflows => project_workflows}/deploy_staging_firebase.yml (100%) rename .github/{workflows => project_workflows}/draft_a_new_release.yml (100%) create mode 100644 .github/project_workflows/publish_docs_to_wiki.yml diff --git a/.github/workflows/automatic_pull_request_review.yml b/.github/project_workflows/automatic_pull_request_review.yml similarity index 100% rename from .github/workflows/automatic_pull_request_review.yml rename to .github/project_workflows/automatic_pull_request_review.yml diff --git a/.github/workflows/deploy_app_store.yml b/.github/project_workflows/deploy_app_store.yml similarity index 100% rename from .github/workflows/deploy_app_store.yml rename to .github/project_workflows/deploy_app_store.yml diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/project_workflows/deploy_production_firebase.yml similarity index 100% rename from .github/workflows/deploy_production_firebase.yml rename to .github/project_workflows/deploy_production_firebase.yml diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/project_workflows/deploy_staging_firebase.yml similarity index 100% rename from .github/workflows/deploy_staging_firebase.yml rename to .github/project_workflows/deploy_staging_firebase.yml diff --git a/.github/workflows/draft_a_new_release.yml b/.github/project_workflows/draft_a_new_release.yml similarity index 100% rename from .github/workflows/draft_a_new_release.yml rename to .github/project_workflows/draft_a_new_release.yml diff --git a/.github/project_workflows/publish_docs_to_wiki.yml b/.github/project_workflows/publish_docs_to_wiki.yml new file mode 100644 index 00000000..dc71b021 --- /dev/null +++ b/.github/project_workflows/publish_docs_to_wiki.yml @@ -0,0 +1,19 @@ +name: Publish docs to Wiki + +on: + push: + paths: + - .github/wiki/** + branches: + - main + - master + +jobs: + publish_docs_to_wiki: + name: Publish Wiki + uses: nimblehq/github-actions-workflows/.github/workflows/publish_wiki.yml@0.1.0 + with: + USER_NAME: team-nimblehq + USER_EMAIL: dev@nimblehq.co + secrets: + USER_TOKEN: ${{ secrets.NIMBLE_DEV_TOKEN }} diff --git a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/Extensions/FileManager+Utils.swift b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/Extensions/FileManager+Utils.swift index 6fd75e11..cf7852da 100644 --- a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/Extensions/FileManager+Utils.swift +++ b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/Extensions/FileManager+Utils.swift @@ -46,13 +46,18 @@ extension FileManager { } } - func createFile(name: String, at directory: String) { + func createDirectory(path: String) { let currentDirectory = currentDirectoryPath do { - try createDirectory(atPath: "\(currentDirectory)/\(directory)", withIntermediateDirectories: true, attributes: nil) + try createDirectory(atPath: "\(currentDirectory)/\(path)", withIntermediateDirectories: true, attributes: nil) } catch { print("Error \(error)") } + } + + func createFile(name: String, at directory: String) { + let currentDirectory = currentDirectoryPath + createDirectory(path: directory) createFile(atPath: "\(currentDirectory)\(directory)\(name)", contents: nil) } diff --git a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift index a126355c..06436a46 100644 --- a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift +++ b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpCICDService.swift @@ -36,6 +36,10 @@ struct SetUpCICDService { print("Setting template for Github Actions") fileManager.removeItems(in: "bitrise.yml") fileManager.removeItems(in: "codemagic.yaml") + fileManager.removeItems(in: ".github/workflows") + fileManager.createDirectory(path: ".github/workflows") + fileManager.moveFiles(in: ".github/project_workflows", to: ".github/workflows") + fileManager.removeItems(in: ".github/project_workflows") case .bitrise: print("Setting template for Bitrise") fileManager.removeItems(in: "codemagic.yaml") diff --git a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/iOSTemplateMaker.swift b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/iOSTemplateMaker.swift index eeac8595..ea1b341d 100644 --- a/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/iOSTemplateMaker.swift +++ b/Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/iOSTemplateMaker.swift @@ -23,7 +23,7 @@ extension iOSTemplateMaker { var projectName: String? @Option(help: "The minimum iOS version (14.0)") var minimumVersion: String? - @Option(help: "The user interface frameword (SwiftUI or UIKit)") + @Option(help: "The user interface framework (SwiftUI or UIKit)") var interface: String? mutating func run() {