Merge pull request #4420 from status-im/feature/add-VERSION-file
Keep current version of app in the VERSION file
This commit is contained in:
commit
dd651f1e82
|
@ -22,7 +22,7 @@ timeout(90) {
|
|||
def apkUrl = ''
|
||||
def ipaUrl = ''
|
||||
def testPassed = true
|
||||
def latest_tag;
|
||||
def version;
|
||||
|
||||
load "$HOME/env.groovy"
|
||||
|
||||
|
@ -33,16 +33,18 @@ timeout(90) {
|
|||
|
||||
checkout scm
|
||||
|
||||
version = readFile "${env.WORKSPACE}/VERSION"
|
||||
|
||||
sh 'git fetch --tags'
|
||||
latest_tag = sh(returnStdout: true, script: 'git describe --tags `git rev-list --tags=release --max-count=1`').trim()
|
||||
sh 'rm -rf node_modules'
|
||||
sh 'cp .env.nightly .env'
|
||||
sh 'lein deps'
|
||||
|
||||
installJSDeps()
|
||||
|
||||
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
|
||||
sh 'cd ios && pod install && cd ..'
|
||||
}
|
||||
sh 'cd ios && pod install && cd ..'
|
||||
}
|
||||
|
||||
stage('Tests') {
|
||||
sh 'lein test-cljs'
|
||||
|
@ -58,8 +60,8 @@ timeout(90) {
|
|||
|
||||
stage('Build (iOS)') {
|
||||
withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) {
|
||||
def build_no = sh(returnStdout: true, script: 'git rev-list --count HEAD').trim()
|
||||
sh ('plutil -replace CFBundleShortVersionString -string ' + latest_tag + ' ios/StatusIm/Info.plist')
|
||||
def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim()
|
||||
sh ('plutil -replace CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
|
||||
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' ios/StatusIm/Info.plist')
|
||||
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
|
||||
sh ('security unlock-keychain -p ' + password + ' login.keychain')
|
||||
|
@ -81,8 +83,7 @@ timeout(90) {
|
|||
def buildInfo = server.upload(uploadSpec)
|
||||
apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename
|
||||
|
||||
//todo: handle version differently instead of exit 0
|
||||
sh ('bundle exec fastlane android nightly || exit 0')
|
||||
sh ('bundle exec fastlane android nightly')
|
||||
sh ('echo ARTIFACT Android: ' + apkUrl)
|
||||
}
|
||||
|
||||
|
@ -93,8 +94,7 @@ timeout(90) {
|
|||
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
||||
ipaUrl = 'https://i.diawi.com/' + hash
|
||||
|
||||
//todo: handle version differently instead of exit 0
|
||||
sh ('bundle exec fastlane ios nightly || exit 0')
|
||||
sh ('bundle exec fastlane ios nightly')
|
||||
sh ('echo ARTIFACT iOS: ' + ipaUrl)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ timeout(90) {
|
|||
|
||||
checkout scm
|
||||
|
||||
version = BRANCH_NAME.substring(8)
|
||||
sh 'echo "' + version + '" > .version'
|
||||
version = readFile "${env.WORKSPACE}/VERSION"
|
||||
|
||||
sh 'git fetch --tags'
|
||||
|
||||
|
@ -64,7 +63,7 @@ timeout(90) {
|
|||
}
|
||||
|
||||
stage('Build (iOS)') {
|
||||
def build_no = sh(returnStdout: true, script: './build_no.sh --tag').trim()
|
||||
def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim()
|
||||
sh ('plutil -replace CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
|
||||
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' ios/StatusIm/Info.plist')
|
||||
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
|
||||
|
|
|
@ -37,8 +37,7 @@ timeout(90) {
|
|||
|
||||
checkout scm
|
||||
|
||||
version = BRANCH_NAME.substring(8)
|
||||
sh 'echo "' + version + '" > .version'
|
||||
version = readFile "${env.WORKSPACE}/VERSION"
|
||||
|
||||
sh 'git fetch --tags'
|
||||
|
||||
|
@ -65,7 +64,7 @@ timeout(90) {
|
|||
|
||||
stage('Build (iOS)') {
|
||||
withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) {
|
||||
def build_no = sh(returnStdout: true, script: './build_no.sh --tag').trim()
|
||||
def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim()
|
||||
sh ('plutil -replace CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
|
||||
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' ios/StatusIm/Info.plist')
|
||||
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
|
||||
|
@ -75,11 +74,11 @@ timeout(90) {
|
|||
}
|
||||
|
||||
stage('Deploy (Android)') {
|
||||
sh ('bundle exec fastlane android release || exit 0')
|
||||
sh ('bundle exec fastlane android release')
|
||||
}
|
||||
|
||||
stage('Deploy (iOS)') {
|
||||
sh ('bundle exec fastlane ios release || exit 0')
|
||||
sh ('bundle exec fastlane ios release')
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ def enableProguardInReleaseBuilds = false
|
|||
def getVersionCode = { ->
|
||||
new ByteArrayOutputStream().withStream { stdOut ->
|
||||
exec {
|
||||
commandLine "sh", "../../build_no.sh", "--tag"
|
||||
commandLine "sh", "../../scripts/build_no.sh"
|
||||
standardOutput = stdOut
|
||||
errorOutput = System.err
|
||||
}
|
||||
|
@ -111,12 +111,8 @@ def getVersionName = { ->
|
|||
if (project.hasProperty("releaseVersion")) {
|
||||
return project.releaseVersion
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine "git", "describe", "--tags", "--always", "--dirty=+"
|
||||
standardOutput = stdOut
|
||||
}
|
||||
return stdOut.toString().replaceAll("\\s","")
|
||||
version = new File('../VERSION').text
|
||||
return version.replaceAll("\\s","")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,18 +22,20 @@ INFO_PLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
|
|||
if [[ $(git ls-files -m "StatusIm/Info.plist") = *"Info.plist"* ]]; then
|
||||
echo "version was set in Info.plist"
|
||||
else
|
||||
RELEASE_VERSION=$(cat ../VERSION)
|
||||
# Build version (closest-tag-or-branch "-" commits-since-tag "-" short-hash dirty-flag)
|
||||
BUILD_VERSION=$(git describe --tags --always --dirty=+)
|
||||
BUILD_VERSION="${RELEASE_VERSION}-$(git describe --always --dirty=+)"
|
||||
|
||||
# Use the latest tag for short version (expected tag format "vn[.n[.n]]")
|
||||
# or if there are no tags, we make up version 0.0.<commit count>
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null) || LATEST_TAG="HEAD"
|
||||
LATEST_TAG=${RELEASE_VERSION} || LATEST_TAG="HEAD"
|
||||
if [ $LATEST_TAG = "HEAD" ]
|
||||
then COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
LATEST_TAG="0.0.$COMMIT_COUNT"
|
||||
COMMIT_COUNT_SINCE_TAG=0
|
||||
else
|
||||
COMMIT_COUNT_SINCE_TAG=$(git rev-list --count ${LATEST_TAG}..)
|
||||
VERSION_CHANGE_COMMIT=$(git log -n 1 --pretty=format:%H -- ../VERSION)
|
||||
COMMIT_COUNT_SINCE_TAG=$(git rev-list --count ${VERSION_CHANGE_COMMIT}..)
|
||||
LATEST_TAG=${LATEST_TAG##v} # Remove the "v" from the front of the tag
|
||||
fi
|
||||
if [ $COMMIT_COUNT_SINCE_TAG = 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue