Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
G Guides
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ios-general
  • Guides
  • Wiki
  • jenkins auto build

jenkins auto build · Changes

Page history
Update jenkins auto build authored Mar 26, 2018 by Artem Kalmykov's avatar Artem Kalmykov
Show whitespace changes
Inline Side-by-side
Showing with 45 additions and 1 deletion
+45 -1
  • jenkins-auto-build.md jenkins-auto-build.md +45 -1
  • No files found.
jenkins-auto-build.md
View page @ 33dde455
...@@ -7,4 +7,48 @@ If you want to create a new app for auto builds go to Jenkins and copy an existi ...@@ -7,4 +7,48 @@ If you want to create a new app for auto builds go to Jenkins and copy an existi
- `Source code management` section should be setup according to the project. The good practice is to give `Jenkins` Gitlab user permissions to read/write into the repository and use that user's credentials in Jenkins job. Don't forget to specify the default branch. - `Source code management` section should be setup according to the project. The good practice is to give `Jenkins` Gitlab user permissions to read/write into the repository and use that user's credentials in Jenkins job. Don't forget to specify the default branch.
- Under `Source code management` `Wipe out repository & force clone` option may be specified under `Additional behaviours` to be sure that git-related commands succeed. - Under `Source code management` `Wipe out repository & force clone` option may be specified under `Additional behaviours` to be sure that git-related commands succeed.
- Under `Post-build actions`, `Archive the artifacts` option may be specified with the following parameter: `*.ipa, *.dSYM.zip` to export `ipa` file and debug symbols. - Under `Post-build actions`, `Archive the artifacts` option may be specified with the following parameter: `*.ipa, *.dSYM.zip` to export `ipa` file and debug symbols.
- Under `Post-build actions` - Under `Post-build actions` change parameter of `E-mail notification` to your email.
\ No newline at end of file
# Build script
Build script looks like this:
```
security default-keychain -s ~/Library/Keychains/jenkins.keychain-db
security unlock-keychain -p Aa123654ff ~/Library/Keychains/jenkins.keychain-db
plistFile="HealthMonitor/ITPMonitor-Info.plist"
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $plistFile)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" $plistFile
if [ $LiveBuild = true ]
then
configuration="Release_Live"
else
configuration="Release_Dev"
fi
xcodebuild -workspace HealthMonitor.xcworkspace -scheme ITPMonitor -configuration $configuration archive -archivePath ITP.xcarchive -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath ITP.xcarchive -exportOptionsPlist exportOptions.plist -exportPath . -allowProvisioningUpdates
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f ITPMonitor.ipa -u developer@faifly.com -p Gfhjkm1!
git checkout develop
git add $plistFile
git commit -am "Increment build number."
git reset --hard
git pull origin develop
git push origin develop
```
The first two lines change the default keychain and unlock it. This prevents macOS to ask permissions to unlock the keychain, which will cause build to be stuck.
Lines 4-8 take plist file and increment build number.
Lines 10-15 determine which configuration should be used according to LiveBuild job parameter.
Line 17 archives the project with given workspace, scheme, configuration and archive path. Don't forget to change these values.
Line 18 exports the archive to create an `ipa` file.
Line 19 uploads the ipa to iTunes Connect using Faifly's default user's credentials. Make sure that this user (developer@faifl.com) is added to iTunes Connect and has permissions to upload builds.
The rest of the lines commit plist file and push it to the repository to keep build version up-to-date. Don't forget to change branch name.
\ No newline at end of file
Clone repository
  • Swift Code Style
  • automated slack builds
  • continuous integration
  • Home
  • jenkins auto build
  • shared localization
  • versioning rules