diff --git a/.circleci/config.yml b/.circleci/config.yml index bc4ef45..f9545b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,141 +1,291 @@ version: 2 + +references: + + xcode_version: &xcode_version "9.2.0" + + container_config: &container_config + macos: + xcode: *xcode_version + + build_app: &build_app + run: + name: Build app + command: source ci/scripts/build.sh + + bundler_config: &bundler_config + run: + name: Configure bundler + command: source ./ci/scripts/bundler_config.sh + + install_ruby: &install_ruby + run: + name: Configure Ruby dependencies + command: source ./ci/scripts/install_ruby.sh + + set_locate: &set_locate + run: + name: Configure utf-8 locate + command: source ./ci/scripts/set_locate.sh + + fastlane_config: &fastlane_config + run: + name: Configure Fastlane environment variables + command: source ./ci/scripts/fastlane_config.sh + + test_app: &test_app + run: + name: Test project + command: source ./ci/scripts/test.sh + + install: &install + run: + name: Install dependencies + command: source ./ci/scripts/install.sh + + keychain_add: &keychain_add + run: + name: Create keychain & Add certificates + command: source ./ci/scripts/keychain_add.sh + environment: + CERTIFICATES_PATH: ./ci/cert + KEYCHAIN_NAME: ios-app.keychain + + git_config: &git_config + run: + name: Configure github + command: source ./ci/scripts/git_config.sh + + transifex: &transifex + run: + name: Configure Transifex + command: source ./ci/scripts/transifex.sh + + deploy_develop: &deploy_develop + run: + name: Generate changelog, docs, coverage and snapshots + command: source ./ci/scripts/deploy_develop.sh + environment: + SCRIPT_PATH: ./ci/scripts + + deploy_master: &deploy_master + run: + name: Master deploy + command: source ./ci/scripts/deploy_master.sh + environment: + SCRIPT_PATH: ./ci/scripts + + keychain_remove: &keychain_remove + run: + name: Remove keychain & certificates + command: source ./ci/scripts/keychain_remove.sh + environment: + KEYCHAIN_NAME: ios-app.keychain + + store_ipa: &store_ipa + store_artifacts: + path: ./$APPNAME.ipa + + create_documentation: &create_documentation + run: + name: Generate documentation + command: source ci/scripts/documentation.sh + environment: + DOCUMENTATION_DESTINATION: development/code-documentation/ + + create_coverage: &create_coverage + run: + name: Generate coverage + command: source ci/scripts/coverage.sh + environment: + COVERAGE_DESTINATION: development/coverage/ + TEST_REPORT_DESTINATION: development/test-reports/ + + create_screenshots: &create_screenshots + run: + name: Generate screenshots + command: source ci/scripts/screenshots.sh + environment: + SCREENSHOTS_DESTINATION: screenshots + + update_cache: &update_cache + run: + name: Update cache gh-pages + command: source ci/scripts/update_cache.sh + + beta_version: &beta_version + run: + name: Send app to TestFligth + command: source ci/scripts/beta_version.sh + environment: + SCRIPT_PATH: ci/scripts + + release_app: &release_app + run: + name: Release app + command: source ci/scripts/release.sh + + publish_app: &publish_app + run: + name: Publish app + command: source ci/scripts/publish_app.sh + environment: + SCRIPT_PATH: ci/scripts + + update_cache: &update_cache + run: + name: Update cache + command: source ci/scripts/update_cache.sh + + update_develop: &update_develop + run: + name: Update develop branch + command: source ci/scripts/update_develop.sh + jobs: + build: - macos: - xcode: "9.2.0" + <<: *container_config steps: - checkout - - run: - name: Build and Test project - command: source ./ci/scripts/build.sh + - *build_app test: - macos: - xcode: "9.2.0" + <<: *container_config steps: - checkout - - run: - name: Configure bundler - command: source ./ci/scripts/bundler_config.sh - - run: - name: Configure Ruby dependencies - command: source ./ci/scripts/install_ruby.sh - - run: - name: Configure utf-8 locate - command: source ./ci/scripts/set_locate.sh - - run: - name: Configure Fastlane environment variables - command: source ./ci/scripts/fastlane_config.sh - - run: - name: Build and Test project - command: source ./ci/scripts/test.sh - - deploy_develop: - macos: - xcode: "9.2.0" + - *bundler_config + - *install_ruby + - *set_locate + - *fastlane_config + - *test_app + + documentation: + <<: *container_config steps: - checkout - - run: - name: Configure bundler - command: source ./ci/scripts/bundler_config.sh - - run: - name: Install dependencies - command: source ./ci/scripts/install.sh - - run: - name: Configure utf-8 locate - command: source ./ci/scripts/set_locate.sh - - run: - name: Configure Fastlane environment variables - command: source ./ci/scripts/fastlane_config.sh - - run: - name: Create keychain & Add certificates - command: source ./ci/scripts/keychain_add.sh - environment: - CERTIFICATES_PATH: ./ci/cert - KEYCHAIN_NAME: ios-app.keychain - - run: - name: Configure github - command: source ./ci/scripts/git_config.sh - - run: - name: Configure Transifex - command: source ./ci/scripts/transifex.sh - - run: - name: Build and Test project - command: source ./ci/scripts/test.sh - - run: - name: Generate changelog, docs, coverage and snapshots - command: source ./ci/scripts/deploy_develop.sh - environment: - SCRIPT_PATH: ./ci/scripts - - run: - name: Remove keychain & certificates - command: source ./ci/scripts/keychain_remove.sh - environment: - KEYCHAIN_NAME: ios-app.keychain - - deploy_master: - macos: - xcode: "9.2.0" + - *bundler_config + - *install + - *set_locate + - *git_config + - *create_documentation + + coverage: + <<: *container_config + steps: + - checkout + - *bundler_config + - *install + - *set_locate + - *fastlane_config + - *git_config + - *test_app + - *create_coverage + + screenshots: + <<: *container_config + steps: + - checkout + - *bundler_config + - *install + - *set_locate + - *fastlane_config + - *git_config + - *transifex + - *create_screenshots + + test_fligth: + <<: *container_config + steps: + - checkout + - *bundler_config + - *install + - *set_locate + - *fastlane_config + - *keychain_add + - *git_config + - *transifex + - *beta_version + + release: + <<: *container_config steps: - checkout - - run: - name: Configure bundler - command: source ./ci/scripts/bundler_config.sh - - run: - name: Install dependencies - command: source ./ci/scripts/install.sh - - run: - name: Configure utf-8 locate - command: source ./ci/scripts/set_locate.sh - - run: - name: Configure Fastlane environment variables - command: source ./ci/scripts/fastlane_config.sh - - run: - name: Create keychain & Add certificates - command: source ./ci/scripts/keychain_add.sh - environment: - CERTIFICATES_PATH: ./ci/cert - KEYCHAIN_NAME: ios-app.keychain - - run: - name: Configure github - command: source ./ci/scripts/git_config.sh - - run: - name: Configure Transifex - command: source ./ci/scripts/transifex.sh - - run: - name: Master deploy - command: source ./ci/scripts/deploy_master.sh - environment: - SCRIPT_PATH: ./ci/scripts - - store_artifacts: - path: ./$APPNAME.ipa - - run: - name: Remove keychain & certificates - command: source ./ci/scripts/keychain_remove.sh - environment: - KEYCHAIN_NAME: ios-app.keychain + - *bundler_config + - *install + - *set_locate + - *fastlane_config + - *keychain_add + - *git_config + - *transifex + - *release_app + - *publish_app + - *update_develop + + update_cache: + <<: *container_config + steps: + - checkout + - *bundler_config + - *install + - *set_locate + - *git_config + - *update_cache workflows: version: 2 - build-and-test: + build-test-deploy: jobs: - build - test: + requires: + - build + - documentation: + requires: + - test filters: branches: - ignore: + only: + - master - develop - - deploy_develop: + - coverage: requires: - - build + - test filters: branches: - only: + only: + - master - develop - - deploy_master: + - screenshots: requires: - test filters: branches: - only: + only: - master + - test_fligth: + requires: + - test + filters: + branches: + only: + - develop + - release: + requires: + - screenshots + - coverage + - documentation + filters: + branches: + only: + - master + - update_cache: + requires: + - screenshots + - coverage + - documentation + filters: + branches: + only: + - master + - develop diff --git a/FlyveMDMAdminDashboardUITests/SnapshotHelper.swift b/FlyveMDMAdminDashboardUITests/SnapshotHelper.swift index a751eda..ad57513 100644 --- a/FlyveMDMAdminDashboardUITests/SnapshotHelper.swift +++ b/FlyveMDMAdminDashboardUITests/SnapshotHelper.swift @@ -3,7 +3,6 @@ // Example // // Created by Felix Krause on 10/8/15. -// Copyright © 2015 Felix Krause. All rights reserved. // // ----------------------------------------------------- @@ -44,7 +43,7 @@ enum SnapshotError: Error, CustomDebugStringConvertible { case cannotFindSimulatorHomeDirectory case cannotAccessSimulatorHomeDirectory(String) case cannotRunOnPhysicalDevice - + var debugDescription: String { switch self { case .cannotDetectUser: @@ -68,11 +67,11 @@ open class Snapshot: NSObject { static var screenshotsDirectory: URL? { return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) } - + open class func setupSnapshot(_ app: XCUIApplication) { Snapshot.app = app - + do { let cacheDir = try pathPrefix() Snapshot.cacheDirectory = cacheDir @@ -83,7 +82,7 @@ open class Snapshot: NSObject { print(error) } } - + class func setLanguage(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { print("CacheDirectory is not set - probably running on a physical device?") @@ -91,7 +90,7 @@ open class Snapshot: NSObject { } let path = cacheDirectory.appendingPathComponent("language.txt") - + do { let trimCharacterSet = CharacterSet.whitespacesAndNewlines deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) @@ -100,7 +99,7 @@ open class Snapshot: NSObject { print("Couldn't detect/set language...") } } - + class func setLocale(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { print("CacheDirectory is not set - probably running on a physical device?") @@ -108,7 +107,7 @@ open class Snapshot: NSObject { } let path = cacheDirectory.appendingPathComponent("locale.txt") - + do { let trimCharacterSet = CharacterSet.whitespacesAndNewlines locale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) @@ -120,7 +119,7 @@ open class Snapshot: NSObject { } app.launchArguments += ["-AppleLocale", "\"\(locale)\""] } - + class func setLaunchArguments(_ app: XCUIApplication) { guard let cacheDirectory = self.cacheDirectory else { print("CacheDirectory is not set - probably running on a physical device?") @@ -129,7 +128,7 @@ open class Snapshot: NSObject { let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] - + do { let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) @@ -142,16 +141,16 @@ open class Snapshot: NSObject { print("Couldn't detect/set launch_arguments...") } } - + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { if timeout > 0 { waitForLoadingIndicatorToDisappear(within: timeout) } - + print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work - + sleep(1) // Waiting for the animation to be finished (kind of) - + #if os(OSX) XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) #else @@ -161,11 +160,7 @@ open class Snapshot: NSObject { return } - guard let window = app.windows.allElementsBoundByIndex.first(where: { $0.frame.isEmpty == false }) else { - print("Couldn't find an element window in XCUIApplication with a non-empty frame.") - return - } - + let window = app.windows.firstMatch let screenshot = window.screenshot() guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") @@ -177,17 +172,17 @@ open class Snapshot: NSObject { } #endif } - + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { #if os(tvOS) return #endif - + let networkLoadingIndicator = XCUIApplication().otherElements.deviceStatusBars.networkLoadingIndicators.element let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) } - + class func pathPrefix() throws -> URL? { let homeDir: URL // on OSX config is stored in /Users//Library @@ -196,11 +191,11 @@ open class Snapshot: NSObject { guard let user = ProcessInfo().environment["USER"] else { throw SnapshotError.cannotDetectUser } - + guard let usersDir = FileManager.default.urls(for: .userDirectory, in: .localDomainMask).first else { throw SnapshotError.cannotFindHomeDirectory } - + homeDir = usersDir.appendingPathComponent(user) #else #if arch(i386) || arch(x86_64) @@ -222,26 +217,26 @@ open class Snapshot: NSObject { private extension XCUIElementAttributes { var isNetworkLoadingIndicator: Bool { if hasWhiteListedIdentifier { return false } - + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) - + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize } - + var hasWhiteListedIdentifier: Bool { let whiteListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] - + return whiteListedIdentifiers.contains(identifier) } - + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { if elementType == .statusBar { return true } guard frame.origin == .zero else { return false } - + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) let newStatusBarSize = CGSize(width: deviceWidth, height: 44) - + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) } } @@ -250,22 +245,22 @@ private extension XCUIElementQuery { var networkLoadingIndicators: XCUIElementQuery { let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in guard let element = evaluatedObject as? XCUIElementAttributes else { return false } - + return element.isNetworkLoadingIndicator } - + return self.containing(isNetworkLoadingIndicator) } - + var deviceStatusBars: XCUIElementQuery { - let deviceWidth = XCUIApplication().frame.width - + let deviceWidth = XCUIApplication().windows.firstMatch.frame.width + let isStatusBar = NSPredicate { (evaluatedObject, _) in guard let element = evaluatedObject as? XCUIElementAttributes else { return false } - + return element.isStatusBar(deviceWidth) } - + return self.containing(isStatusBar) } } @@ -278,4 +273,4 @@ private extension CGFloat { // Please don't remove the lines below // They are used to detect outdated configuration files -// SnapshotHelperVersion [1.10] +// SnapshotHelperVersion [1.12] diff --git a/Gemfile.lock b/Gemfile.lock index 63f4321..d2baacd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,7 @@ GEM CFPropertyList (3.0.0) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) - atomos (0.1.2) + atomos (0.1.3) babosa (1.0.2) claide (1.0.2) colored (1.2) @@ -18,15 +18,15 @@ GEM dotenv (2.5.0) emoji_regex (0.1.1) excon (0.62.0) - faraday (0.15.2) + faraday (0.15.3) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) faraday (>= 0.7.4) http-cookie (~> 1.0.0) faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.3) - fastlane (2.98.0) + fastimage (2.1.4) + fastlane (2.105.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -41,7 +41,7 @@ GEM faraday_middleware (~> 0.9) fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.21.2, < 0.22.0) + google-api-client (>= 0.21.2, < 0.24.0) highline (>= 1.7.2, < 2.0.0) json (< 3.0.0) mini_magick (~> 4.5.1) @@ -50,7 +50,7 @@ GEM multipart-post (~> 2.0.0) plist (>= 3.1.0, < 4.0.0) public_suffix (~> 2.0.0) - rubyzip (>= 1.2.1, < 2.0.0) + rubyzip (>= 1.2.2, < 2.0.0) security (= 0.1.3) simctl (~> 1.6.3) slack-notifier (>= 2.0.0, < 3.0.0) @@ -59,25 +59,25 @@ GEM tty-screen (>= 0.6.3, < 1.0.0) tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) - xcodeproj (>= 1.5.7, < 2.0.0) - xcpretty (~> 0.2.8) + xcodeproj (>= 1.6.0, < 2.0.0) + xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-xcov_report (1.1.3) gh_inspector (1.1.3) - google-api-client (0.21.2) + google-api-client (0.23.9) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.5, < 0.7.0) httpclient (>= 2.8.1, < 3.0) mime-types (~> 3.0) representable (~> 3.0) retriable (>= 2.0, < 4.0) - googleauth (0.6.2) + signet (~> 0.9) + googleauth (0.6.6) faraday (~> 0.12) jwt (>= 1.4, < 3.0) - logging (~> 2.0) memoist (~> 0.12) multi_json (~> 1.11) - os (~> 0.9) + os (>= 0.9, < 2.0) signet (~> 0.7) highline (1.7.10) http-cookie (1.0.3) @@ -85,21 +85,17 @@ GEM httpclient (2.8.3) json (2.1.0) jwt (2.1.0) - little-plugger (1.1.4) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) memoist (0.16.0) - mime-types (3.1) + mime-types (3.2.2) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) + mime-types-data (3.2018.0812) mini_magick (4.5.1) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.0.0) - nanaimo (0.2.5) + nanaimo (0.2.6) naturally (2.2.0) - os (0.9.6) + os (1.0.0) plist (3.4.0) public_suffix (2.0.5) representable (3.0.4) @@ -108,9 +104,9 @@ GEM uber (< 0.2.0) retriable (3.1.2) rouge (2.0.7) - rubyzip (1.2.1) + rubyzip (1.2.2) security (0.1.3) - signet (0.8.1) + signet (0.9.2) addressable (~> 2.3) faraday (~> 0.9) jwt (>= 1.5, < 3.0) @@ -122,8 +118,8 @@ GEM terminal-notifier (1.8.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - tty-cursor (0.5.0) - tty-screen (0.6.4) + tty-cursor (0.6.0) + tty-screen (0.6.5) tty-spinner (0.8.0) tty-cursor (>= 0.5.0) uber (0.1.0) @@ -132,19 +128,19 @@ GEM unf_ext (0.0.7.5) unicode-display_width (1.4.0) word_wrap (1.0.0) - xcodeproj (1.5.9) + xcodeproj (1.6.0) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.5) + nanaimo (~> 0.2.6) xcov (1.3.5) fastlane (>= 2.82.0, < 3.0.0) multipart-post slack-notifier terminal-table xcodeproj - xcpretty (0.2.8) + xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.0) xcpretty (~> 0.2, >= 0.0.7) @@ -158,4 +154,4 @@ DEPENDENCIES xcov (= 1.3.5) BUNDLED WITH - 1.16.2 + 1.16.5 diff --git a/ci/scripts/app_info.sh b/ci/scripts/app_info.sh index 7b9de43..fc81ed0 100755 --- a/ci/scripts/app_info.sh +++ b/ci/scripts/app_info.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# app_info.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ # Get version app GIT_TAG=$(jq -r ".version" package.json) diff --git a/ci/scripts/beta_version.sh b/ci/scripts/beta_version.sh new file mode 100644 index 0000000..6673c99 --- /dev/null +++ b/ci/scripts/beta_version.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $CIRCLE_BRANCH == "develop" ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + +fi + +# Get version number from package.json +export GIT_TAG=$(jq -r ".version" package.json) +# Update CFBundleShortVersionString +/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist +# Update CFBundleVersion +/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist +# Add modified and delete files +git add ${APPNAME}/Info.plist +git commit --amend --no-edit + +# Update app info +source "${SCRIPT_PATH}/app_info.sh" +# Send app to TestFligth +bundle exec fastlane beta \ No newline at end of file diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index b522d52..a8a3ea1 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -1,28 +1,30 @@ #!/bin/sh -# LICENSE # -# build.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ xcodebuild clean build -workspace ${APPNAME}.xcworkspace -scheme $APPNAME CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ No newline at end of file diff --git a/ci/scripts/bundler_config.sh b/ci/scripts/bundler_config.sh index f8dc53d..673b9ce 100755 --- a/ci/scripts/bundler_config.sh +++ b/ci/scripts/bundler_config.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# bundler_config.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ echo ----------- Configure bundler ------------ echo :update_sources: true >> ~/.gemrc diff --git a/ci/scripts/coverage.sh b/ci/scripts/coverage.sh new file mode 100644 index 0000000..f233352 --- /dev/null +++ b/ci/scripts/coverage.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then + + if [[ $CIRCLE_BRANCH == "develop" ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + + fi + + # Get version number from package.json + export GIT_TAG=$(jq -r ".version" package.json) + # Update CFBundleShortVersionString + /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist + # Update CFBundleVersion + /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist + # Add modified and delete files + git add ${APPNAME}/Info.plist + git commit --amend --no-edit + + echo "Generate code coverage reporting with xcov" + # Generate code coverage reporting with xcov + bundle exec fastlane coverage + + # Add coverage folder + git add coverage -f + # Create commit, NOTICE: this commit is not sent + git commit -m "ci(docs): generate **coverage** for version ${GIT_TAG}" + # Update coverage on gh-pages branch + yarn gh-pages --dist coverage --dest "${COVERAGE_DESTINATION}${CIRCLE_BRANCH}" -m "ci(docs): generate coverage with xcov for version ${GIT_TAG}" + + echo "Generate test report" + # Create header content to test report + echo "---" > header.html + echo "layout: modal" >> header.html + echo "---" >> header.html + + # Add header to test report + (cat header.html ; cat fastlane/test_output/report.html) > fastlane/test_output/index.html + # Remove test report copy + rm fastlane/test_output/report.html + rm header.html + + # Generate test report + yarn gh-pages --dist fastlane/test_output --src index.html --dest "${TEST_REPORT_DESTINATION}${CIRCLE_BRANCH}" -m "ci(docs): generate test report for version ${GIT_TAG}" + +fi diff --git a/ci/scripts/deploy_develop.sh b/ci/scripts/deploy_develop.sh deleted file mode 100755 index 42f06a7..0000000 --- a/ci/scripts/deploy_develop.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh - -# LICENSE -# -# deploy_develop.sh is part of FlyveMDMAdminDashboard -# -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. -# -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. -# -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ - -GITHUB_COMMIT_MESSAGE=$(git log --format=oneline -n 1 $CIRCLE_SHA1) - -if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then - echo "Generate CHANGELOG.md and increment version" - # Get gh=pages branch - git fetch origin gh-pages - # Generate CHANGELOG.md and increment version - yarn standard-version -- -t '' - # Get version number from package.json - export GIT_TAG=$(jq -r ".version" package.json) - # Update CFBundleShortVersionString - /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist - # Update CFBundleVersion - /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist - # Add modified and delete files - git add ${APPNAME}/Info.plist - # Create commit - git commit -m "ci(beta): generate **beta** for version ${GIT_TAG}" - - echo "Generate documentation with jazzy" - # Generate documentation with jazzy - jazzy - mv docs/ code-documentation/ - # Add docs folder - git add code-documentation -f - # Create commit, NOTICE: this commit is not sent - git commit -m "ci(docs): generate **docs** for version ${GIT_TAG}" - # Update documentation on gh-pages branch - yarn gh-pages --dist code-documentation --dest development/code-documentation -m "ci(docs): generate documentation with jazzy for version ${GIT_TAG}" - - echo "Generate code coverage reporting with xcov" - # Generate code coverage reporting with xcov - bundle exec fastlane coverage - - # Add coverage folder - git add coverage -f - # Create commit, NOTICE: this commit is not sent - git commit -m "ci(docs): generate **coverage** for version ${GIT_TAG}" - # Update coverage on gh-pages branch - yarn gh-pages --dist coverage --dest development/coverage -m "ci(docs): generate coverage with xcov for version ${GIT_TAG}" - - echo "Generate test report" - # Create header content to test report - echo "---" > header.html - echo "layout: modal" >> header.html - echo "---" >> header.html - - # Add header to test report - (cat header.html ; cat fastlane/test_output/report.html) > fastlane/test_output/index.html - # Remove test report copy - rm fastlane/test_output/report.html - rm header.html - - # Generate test report - yarn gh-pages --dist fastlane/test_output --src index.html --dest development/test-reports -m "ci(docs): generate test report for version ${GIT_TAG}" - - echo "Generate screenshots" - # Generate screenshots - bundle exec fastlane snapshot - - mv fastlane/screenshots/ screenshots/ - - # Create header content to screenshots - echo "---" > header.html - echo "layout: container" >> header.html - echo "namePage: screenshots" >> header.html - echo "---" >> header.html - - # Add header to CHANGELOG.md - (cat header.html ; cat screenshots/screenshots.html) > screenshots/index.html - # Remove CHANGELOG_COPY.md - rm screenshots/screenshots.html - rm header.html - - # Add screenshots folder - git add screenshots -f - # Create commit, NOTICE: this commit is not sent - git commit -m "ci(snapshot): generate **snapshot** for version ${GIT_TAG}" - # Update coverage on gh-pages branch - yarn gh-pages --dist screenshots --dest screenshots -m "ci(snapshot): generate screenshots for version ${GIT_TAG}" - - # Send untracked files to stash - git add . - git stash - # Checkout to gh-pages branch - git checkout gh-pages - git pull origin gh-pages - - echo "Update cache" - # Create header content to cache - echo "---" > header_cache - echo "cache_version: $CIRCLE_SHA1" >> header_cache - echo "---" >> header_cache - # Remove header from file - sed -e '1,3d' sw.js > cache_file - rm sw.js - # Add new header - (cat header_cache ; cat cache_file) > sw.js - # Remove temp files - rm cache_file - rm header_cache - # Add sw.js to git - git add -u - # Create commit - git commit -m "ci(cache): force update cache for version ${GIT_TAG}" - - # Push commit to origin gh-pages branch - git push origin gh-pages - - git checkout $CIRCLE_BRANCH -f - git stash apply stash@{0} - # Update app info - source "${SCRIPT_PATH}/app_info.sh" - # Send app to TestFligth - bundle exec fastlane beta -fi \ No newline at end of file diff --git a/ci/scripts/deploy_master.sh b/ci/scripts/deploy_master.sh deleted file mode 100755 index 3c4e280..0000000 --- a/ci/scripts/deploy_master.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -# LICENSE -# -# deploy_master.sh is part of FlyveMDMAdminDashboard -# -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. -# -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. -# -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ - -GITHUB_COMMIT_MESSAGE=$(git log --format=oneline -n 1 $CIRCLE_SHA1) - -if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then - # Get gh=pages branch - git fetch origin gh-pages - echo "Generate CHANGELOG.md and increment version" - # Generate CHANGELOG.md and increment version - yarn standard-version -t '' -m "ci(release): generate CHANGELOG.md for version %s" - # Get version number from package.json - export GIT_TAG=$(jq -r ".version" package.json) - - echo "Update CHANGELOG.md on gh-pages" - # Create header content to CHANGELOG.md - echo "---" > header.md - echo "layout: modal" >> header.md - echo "title: changelog" >> header.md - echo "---" >> header.md - - # Duplicate CHANGELOG.md - cp CHANGELOG.md CHANGELOG_COPY.md - # Add header to CHANGELOG.md - (cat header.md ; cat CHANGELOG_COPY.md) > CHANGELOG.md - # Remove CHANGELOG_COPY.md - rm CHANGELOG_COPY.md - rm header.md - # Update CHANGELOG.md on gh-pages - yarn gh-pages --dist ./ --src CHANGELOG.md --dest ./ --add -m "ci(docs): generate CHANGELOG.md for version ${GIT_TAG}" - # Reset CHANGELOG.md - git checkout CHANGELOG.md -f - - # Update CFBundleShortVersionString - /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist - # Update CFBundleVersion - /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist - # Add modified and delete files - git add -u - # Create commit - git commit -m "ci(build): release version ${GIT_TAG}" - - echo "Generate screenshots" - # Generate screenshots - bundle exec fastlane snapshot - - mv fastlane/screenshots/ screenshots/ - - # Create header content to screenshots - echo "---" > header.html - echo "layout: container" >> header.html - echo "namePage: screenshots" >> header.html - echo "---" >> header.html - - # Add header to CHANGELOG.md - (cat header.html ; cat screenshots/screenshots.html) > screenshots/index.html - # Remove CHANGELOG_COPY.md - rm screenshots/screenshots.html - rm header.html - - # Update coverage on gh-pages branch - yarn gh-pages --dist screenshots --dest screenshots -m "ci(snapshot): generate screenshots for version ${GIT_TAG}" - - # Push commits and tags to origin branch - git push --follow-tags origin $CIRCLE_BRANCH - echo "Create release with conventional-github-releaser" - # Create release with conventional-github-releaser - yarn conventional-github-releaser -p angular -t $GITHUB_TOKEN - - echo "Create Archive and ipa file" - # Archive App and create ipa file - bundle exec fastlane archive - - echo "Upload ipa file to release" - # Upload ipa file to release - yarn github-release upload \ - --user $CIRCLE_PROJECT_USERNAME \ - --repo $CIRCLE_PROJECT_REPONAME \ - --tag ${GIT_TAG} \ - --name "${APPNAME}.ipa" \ - --file "${APPNAME}.ipa" - - # Send untracked files to stash - git add . - git stash - # Checkout to gh-pages branch - git checkout gh-pages - git pull origin gh-pages - - echo "Update cache" - # Create header content to cache - echo "---" > header_cache - echo "cache_version: $CIRCLE_SHA1" >> header_cache - echo "---" >> header_cache - # Remove header from file - sed -e '1,3d' sw.js > cache_file - rm sw.js - # Add new header - (cat header_cache ; cat cache_file) > sw.js - # Remove temp files - rm cache_file - rm header_cache - # Add sw.js to git - git add -u - # Create commit - git commit -m "ci(cache): force update cache for version ${GIT_TAG}" - - # Push commit to origin gh-pages branch - git push origin gh-pages - - # Update develop branch - git branch -D develop - git fetch origin develop - git checkout develop - # # Merge master on develop - git fetch origin master - git rebase origin/master - git push origin develop - - # Checkout to release branch - git checkout $CIRCLE_BRANCH -f - # Send app to App Store with fastlane - bundle exec fastlane publish -fi diff --git a/ci/scripts/documentation.sh b/ci/scripts/documentation.sh new file mode 100644 index 0000000..7459682 --- /dev/null +++ b/ci/scripts/documentation.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then + + if [[ $CIRCLE_BRANCH == "develop" ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + + fi + + # Get version number from package.json + export GIT_TAG=$(jq -r ".version" package.json) + # Update CFBundleShortVersionString + /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist + # Update CFBundleVersion + /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist + # Add modified and delete files + git add ${APPNAME}/Info.plist + git commit --amend --no-edit + + echo "Generate documentation with jazzy" + # Generate documentation with jazzy + jazzy + mv docs/ code-documentation/ + # Add docs folder + git add code-documentation -f + # Create commit, NOTICE: this commit is not sent + git commit -m "ci(docs): generate **docs** for version ${GIT_TAG}" + # Update documentation on gh-pages branch + yarn gh-pages --dist code-documentation --dest "${DOCUMENTATION_DESTINATION}${CIRCLE_BRANCH}" -m "ci(docs): generate documentation with jazzy for version ${GIT_TAG}" + +fi diff --git a/ci/scripts/fastlane_config.sh b/ci/scripts/fastlane_config.sh index f34c6b2..ca090fc 100755 --- a/ci/scripts/fastlane_config.sh +++ b/ci/scripts/fastlane_config.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# fastlane_config.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ echo ----------- Create Fastlane environment variables ------------ # Create Fastlane environment variables @@ -37,3 +39,6 @@ echo XCODE_SCHEME=$XCODE_SCHEME >> .env echo XCODE_SCHEME_UI=$XCODE_SCHEME_UI >> .env echo XCODE_WORKSPACE=$XCODE_WORKSPACE >> .env echo APP_IDENTIFIER=$APP_IDENTIFIER >> .env + +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 diff --git a/ci/scripts/git_config.sh b/ci/scripts/git_config.sh index 9b3ce93..5ce40cb 100755 --- a/ci/scripts/git_config.sh +++ b/ci/scripts/git_config.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# git_config.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ if [[ -n $GITHUB_TOKEN ]]; then git config --global user.email $GITHUB_EMAIL diff --git a/ci/scripts/install.sh b/ci/scripts/install.sh index 014a221..e4c1611 100755 --- a/ci/scripts/install.sh +++ b/ci/scripts/install.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# install.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ # update ruby brew install ruby diff --git a/ci/scripts/install_ruby.sh b/ci/scripts/install_ruby.sh index b4b6530..05a277e 100755 --- a/ci/scripts/install_ruby.sh +++ b/ci/scripts/install_ruby.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# install_ruby.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ # update ruby brew install ruby diff --git a/ci/scripts/keychain_add.sh b/ci/scripts/keychain_add.sh index c6c8efc..0ed9620 100755 --- a/ci/scripts/keychain_add.sh +++ b/ci/scripts/keychain_add.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# keychain_add.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ echo ----------------- Decrypt custom keychain ------------------ # Decrypt custom keychain diff --git a/ci/scripts/keychain_remove.sh b/ci/scripts/keychain_remove.sh index 1d71b7c..a5faa4b 100755 --- a/ci/scripts/keychain_remove.sh +++ b/ci/scripts/keychain_remove.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# keychain_remove.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ # Delete custom keychain security delete-keychain $KEYCHAIN_NAME diff --git a/ci/scripts/publish_app.sh b/ci/scripts/publish_app.sh new file mode 100644 index 0000000..374dcb8 --- /dev/null +++ b/ci/scripts/publish_app.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then + + # Update app info + source "${SCRIPT_PATH}/app_info.sh" + # Send app to App Store with fastlane + bundle exec fastlane publish + +fi diff --git a/ci/scripts/release.sh b/ci/scripts/release.sh new file mode 100644 index 0000000..40390e7 --- /dev/null +++ b/ci/scripts/release.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.bump=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.bump=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + + # Get version number from package.json + export GIT_TAG=$(jq -r ".version" package.json) + + echo "Update CHANGELOG.md on gh-pages" + # Create header content to CHANGELOG.md + echo "---" > header.md + echo "layout: modal" >> header.md + echo "title: changelog" >> header.md + echo "---" >> header.md + + # Duplicate CHANGELOG.md + cp CHANGELOG.md CHANGELOG_COPY.md + # Add header to CHANGELOG.md + (cat header.md ; cat CHANGELOG_COPY.md) > CHANGELOG.md + # Remove CHANGELOG_COPY.md + rm CHANGELOG_COPY.md + rm header.md + # Update CHANGELOG.md on gh-pages + yarn gh-pages --dist ./ --src CHANGELOG.md --dest ./ --add -m "ci(docs): generate CHANGELOG.md for version ${GIT_TAG}" + # Reset CHANGELOG.md + git checkout CHANGELOG.md -f + + # Update CFBundleShortVersionString + /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" "${PWD}/${APPNAME}/Info.plist" + # Update CFBundleVersion + /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" "${PWD}/${APPNAME}/Info.plist" + # Add modified and delete files + git add -u + # Create commit + git commit -m "ci(build): release version ${GIT_TAG}" + + # Push commits and tags to origin branch + git push --follow-tags origin $CIRCLE_BRANCH + echo "Create release with conventional-github-releaser" + # Create release with conventional-github-releaser + yarn conventional-github-releaser -p angular -t $GITHUB_TOKEN + + echo "Create Archive and ipa file" + # Archive App and create ipa file + bundle exec fastlane archive + + echo "Upload ipa file to release" + # Upload ipa file to release + yarn github-release upload \ + --user "$CIRCLE_PROJECT_USERNAME" \ + --repo "$CIRCLE_PROJECT_REPONAME" \ + --tag "${GIT_TAG}" \ + --name "${APPNAME}.ipa" \ + --file "${APPNAME}.ipa" + + # Update master branch + git fetch origin master + git checkout master + git clean -d -x -f + git merge $CIRCLE_BRANCH + git push origin master + +fi diff --git a/ci/scripts/screenshots.sh b/ci/scripts/screenshots.sh new file mode 100644 index 0000000..2a51f9a --- /dev/null +++ b/ci/scripts/screenshots.sh @@ -0,0 +1,86 @@ +#!/bin/sh + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* && $GITHUB_COMMIT_MESSAGE != *"ci(build): release version"* ]]; then + + if [[ $CIRCLE_BRANCH == "develop" ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + + fi + + # Get version number from package.json + export GIT_TAG=$(jq -r ".version" package.json) + # Update CFBundleShortVersionString + /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist + # Update CFBundleVersion + /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist + # Add modified and delete files + git add ${APPNAME}/Info.plist + git commit --amend --no-edit + echo "Generate screenshots" + # Generate screenshots + bundle exec fastlane snapshot + + mv fastlane/screenshots/ screenshots/ + + # Create header content to screenshots + echo "---" > header.html + echo "layout: container" >> header.html + echo "namePage: screenshots" >> header.html + echo "---" >> header.html + + # Add header to CHANGELOG.md + (cat header.html ; cat screenshots/screenshots.html) > screenshots/index.html + # Remove CHANGELOG_COPY.md + rm screenshots/screenshots.html + rm header.html + + # Add screenshots folder + git add screenshots -f + # Create commit, NOTICE: this commit is not sent + git commit -m "ci(snapshot): generate **snapshot** for version ${GIT_TAG}" + # Update coverage on gh-pages branch + yarn gh-pages --dist screenshots --dest "${SCREENSHOTS_DESTINATION}" -m "ci(snapshot): generate screenshots for version ${GIT_TAG}" + +fi diff --git a/ci/scripts/set_locate.sh b/ci/scripts/set_locate.sh index a74949b..4f4f573 100755 --- a/ci/scripts/set_locate.sh +++ b/ci/scripts/set_locate.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# set_locate.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ echo ---------------------- UTF-8 locale -------------------------- export LC_ALL=en_US.UTF-8 diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh index c21e5b2..1900db4 100755 --- a/ci/scripts/test.sh +++ b/ci/scripts/test.sh @@ -1,28 +1,30 @@ #!/bin/sh -# LICENSE # -# test.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ bundle exec fastlane test diff --git a/ci/scripts/transifex.sh b/ci/scripts/transifex.sh index bac3459..11c6efb 100755 --- a/ci/scripts/transifex.sh +++ b/ci/scripts/transifex.sh @@ -1,29 +1,31 @@ #!/bin/sh -# LICENSE # -# transifex.sh is part of FlyveMDMAdminDashboard +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. # -# FlyveMDMAdminDashboard is a subproject of Flyve MDM. Flyve MDM is a mobile -# device management software. +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # -# FlyveMDMAdminDashboard is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- # -# FlyveMDMAdminDashboard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# ------------------------------------------------------------------------------ -# @author Hector Rondon -# @copyright Copyright © Teclib. All rights reserved. -# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html -# @link https://github.com/flyve-mdm/ios-mdm-dashboard.git -# @link http://flyve.org/ios-mdm-dashboard -# @link https://flyve-mdm.com -# ------------------------------------------------------------------------------ echo ------------------- Configure Transifex -------------------- # Configure Transifex on develop branch diff --git a/ci/scripts/update_cache.sh b/ci/scripts/update_cache.sh new file mode 100644 index 0000000..0c080b3 --- /dev/null +++ b/ci/scripts/update_cache.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +if [[ $CIRCLE_BRANCH == "develop" ]]; then + + # Get old version number from package.json + export GIT_OLD_TAG=$(jq -r ".version" package.json) + # Generate CHANGELOG.md and increment version + IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )"; + + if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then + + PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )"; + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE" + + else + + yarn release -t '' --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" + + fi + +fi + +# Get version number from package.json +export GIT_TAG=$(jq -r ".version" package.json) + +# Send untracked files to stash +git add . +git stash +# Checkout to gh-pages branch +git fetch origin gh-pages +git checkout gh-pages -f +git pull origin gh-pages + +echo "Update cache" +# Create header content to cache +echo "---" > header_cache +echo "cache_version: $CIRCLE_SHA1" >> header_cache +echo "---" >> header_cache +# Remove header from file +sed -e '1,3d' sw.js > cache_file +rm sw.js +# Add new header +(cat header_cache ; cat cache_file) > sw.js +# Remove temp files +rm cache_file +rm header_cache +# Add sw.js to git +git add -u +# Create commit +git commit -m "ci(cache): force update cache for version ${GIT_TAG}" + +# Push commit to origin gh-pages branch +git push origin gh-pages \ No newline at end of file diff --git a/ci/scripts/update_develop.sh b/ci/scripts/update_develop.sh new file mode 100755 index 0000000..fd78369 --- /dev/null +++ b/ci/scripts/update_develop.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# +# LICENSE +# +# This file is part of Flyve MDM Admin Dashboard for iOS. +# +# Admin Dashboard for iOS is a subproject of Flyve MDM. +# Flyve MDM is a mobile device management software. +# +# Flyve MDM is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# Flyve MDM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# ------------------------------------------------------------------- +# @author Hector Rondon - +# @copyright Copyright Teclib. All rights reserved. +# @license LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.html +# @link https://github.com/flyve-mdm/ios-mdm-dashboard/ +# @link http://flyve.org/ios-mdm-dashboard/ +# @link https://flyve-mdm.com +# ------------------------------------------------------------------- +# + +# Update develop branch + git fetch origin develop + git checkout develop + git clean -d -x -f + git merge $CIRCLE_BRANCH + git push origin develop diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 0eae2b6..c75c803 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -11,7 +11,7 @@ # This is the minimum version number required. # Update this, if you use features of a newer version -fastlane_version "2.98.0" +fastlane_version "2.105.1" default_platform :ios diff --git a/package.json b/package.json index c0b9e5d..c82a6cb 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Admin Dashboard for iOS", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "release": "yarn standard-version" }, "repository": { "type": "git",