Coder Social home page Coder Social logo

cicd-example's Introduction

Github SSH key

  • Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install fastlane
brew install fastlane
  • Navigate your terminal to your project's directory
cd ./PATH/cicd-example
  • Setting up fastlane
fastlane init
  • Choose setup
[22:43:37]: -----------------------------
[22:43:37]: --- Welcome to fastlane ๐Ÿš€ ---
[22:43:37]: -----------------------------
[22:43:37]: fastlane can help you with all kinds of automation for your mobile app
[22:43:37]: We recommend automating one task first, and then gradually automating more over time
[22:43:37]: What would you like to use fastlane for?
1. ๐Ÿ“ธ  Automate screenshots
2. ๐Ÿ‘ฉโ€โœˆ๏ธ  Automate beta distribution to TestFlight
3. ๐Ÿš€  Automate App Store distribution
4. ๐Ÿ›   Manual setup - manually setup your project to automate your tasks
?  4
  • Config Fastfile
platform :ios do
  desc "Build Test Flight"
  # Deletes files archives as result
  before_all do
      sh(command: "rm -vfr ~/Library/Developer/Xcode/Archives/*")
      clear_derived_data()
      xcode_select("/Applications/Xcode.app")
  end

  # release build
  lane :release do
    match(type: "appstore", 
          app_identifier: "mobile.duc.***",
          readonly: is_ci)
    increment_build_number(xcodeproj: "cicd-example.xcodeproj")
    build_app(
      scheme: "MobileCiCd",
      export_method: "app-store"
    )
    upload_to_testflight
  end

  # Deletes files created as result of running gym, cert, sigh or download_dsyms
  after_all do |lane|
      clean_build_artifacts
  end
end
  • Install matchfile
fastlane match init
  • Choose setup
[โœ”] ๐Ÿš€ 
[14:03:49]: fastlane match supports multiple storage modes, please select the one you want to use:
1. git
2. google_cloud
3. s3
4. gitlab_secure_files
?  1
[14:03:55]: Please create a new, private git repository to store the certificates and profiles there
[14:03:55]: URL of the Git Repo: [email protected]:nmduc2511/cert-provision-cicd.git
[14:08:38]: Successfully created './fastlane/Matchfile'. You can open the file using a code editor.
[14:08:38]: You can now run `fastlane match development`, `fastlane match adhoc`, `fastlane match enterprise` and `fastlane match appstore`
  • Config match file
git_url("[email protected]:nmduc2511/cert-provision-cicd.git")

storage_mode("git")

type("appstore") # The default type, can be: appstore, adhoc, enterprise or development

app_identifier("mobile.duc..cicd-example") # bundle id app
username("n*****@gmail.com") # Your Apple Developer Portal username
  • To set up the certificates and provisioning profiles on a new machine
fastlane match appstore
  • You can also run match in a readonly mode to be sure it won't create any new certificates or profiles.
fastlane match appstore --readonly
  • Or setup in ./fastlane/Fastfile (Recommend)
lane :appstore do
  match(type: "appstore", readonly: is_ci)
end
... result
[14:19:40]: โ–ธ -----END CERTIFICATE-----
[14:19:41]: Downloading provisioning profile...
[14:19:41]: Successfully downloaded provisioning profile...
[14:19:41]: Installing provisioning profile...
/var/folders/2h/7rqr0mfn7kd735ws6yl9plb00000gq/T/d20230316-26095-3eh5kt/profiles/appstore/AppStore_mobile.duc..cicd-example.mobileprovision
[14:19:42]: Installing provisioning profile...
[14:19:45]: ๐Ÿ”’  Successfully encrypted certificates repo
[14:19:45]: Pushing changes to remote git repo...
[14:19:50]: Finished uploading files to Git Repo [[email protected]:nmduc2511/cert-provision-cicd.git]
+---------------------+-----------------------------------------+-----------------------------------------+
|                                     Installed Provisioning Profile                                      |
+---------------------+-----------------------------------------+-----------------------------------------+
[14:19:50]: All required keys, certificates and provisioning profiles are installed ๐Ÿ™Œ
  • Repos Git github_repo
  • Visit appleid.apple.com/account/manage
  • Generate a new application specific password
  • Provide the application specific password using the environment variable FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD
  • Generate .env(environment)
touch .env
  • Config .env file
FASTLANE_USER= // apple userid
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=***-***-***-***

Config Runner To Run self-hosted

cicd-example's People

Contributors

nmduc2511 avatar ducnguyendjv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.