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:
Jakub 2018-05-25 07:32:30 +02:00 committed by GitHub
commit dd651f1e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 28 deletions

View File

@ -22,7 +22,7 @@ timeout(90) {
def apkUrl = '' def apkUrl = ''
def ipaUrl = '' def ipaUrl = ''
def testPassed = true def testPassed = true
def latest_tag; def version;
load "$HOME/env.groovy" load "$HOME/env.groovy"
@ -33,11 +33,13 @@ timeout(90) {
checkout scm checkout scm
version = readFile "${env.WORKSPACE}/VERSION"
sh 'git fetch --tags' 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 'rm -rf node_modules'
sh 'cp .env.nightly .env' sh 'cp .env.nightly .env'
sh 'lein deps' sh 'lein deps'
installJSDeps() installJSDeps()
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack' sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
@ -58,8 +60,8 @@ timeout(90) {
stage('Build (iOS)') { stage('Build (iOS)') {
withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) { withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) {
def build_no = sh(returnStdout: true, script: 'git rev-list --count HEAD').trim() def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim()
sh ('plutil -replace CFBundleShortVersionString -string ' + latest_tag + ' ios/StatusIm/Info.plist') sh ('plutil -replace CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' 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 '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') sh ('security unlock-keychain -p ' + password + ' login.keychain')
@ -81,8 +83,7 @@ timeout(90) {
def buildInfo = server.upload(uploadSpec) def buildInfo = server.upload(uploadSpec)
apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename
//todo: handle version differently instead of exit 0 sh ('bundle exec fastlane android nightly')
sh ('bundle exec fastlane android nightly || exit 0')
sh ('echo ARTIFACT Android: ' + apkUrl) 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() 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 ipaUrl = 'https://i.diawi.com/' + hash
//todo: handle version differently instead of exit 0 sh ('bundle exec fastlane ios nightly')
sh ('bundle exec fastlane ios nightly || exit 0')
sh ('echo ARTIFACT iOS: ' + ipaUrl) sh ('echo ARTIFACT iOS: ' + ipaUrl)
} }
} }

View File

@ -37,8 +37,7 @@ timeout(90) {
checkout scm checkout scm
version = BRANCH_NAME.substring(8) version = readFile "${env.WORKSPACE}/VERSION"
sh 'echo "' + version + '" > .version'
sh 'git fetch --tags' sh 'git fetch --tags'
@ -64,7 +63,7 @@ timeout(90) {
} }
stage('Build (iOS)') { 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 CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' 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 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'

View File

@ -37,8 +37,7 @@ timeout(90) {
checkout scm checkout scm
version = BRANCH_NAME.substring(8) version = readFile "${env.WORKSPACE}/VERSION"
sh 'echo "' + version + '" > .version'
sh 'git fetch --tags' sh 'git fetch --tags'
@ -65,7 +64,7 @@ timeout(90) {
stage('Build (iOS)') { stage('Build (iOS)') {
withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) { 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 CFBundleShortVersionString -string ' + version + ' ios/StatusIm/Info.plist')
sh ('plutil -replace CFBundleVersion -string ' + build_no + ' 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 '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)') { stage('Deploy (Android)') {
sh ('bundle exec fastlane android release || exit 0') sh ('bundle exec fastlane android release')
} }
stage('Deploy (iOS)') { stage('Deploy (iOS)') {
sh ('bundle exec fastlane ios release || exit 0') sh ('bundle exec fastlane ios release')
} }

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.9.19

View File

@ -98,7 +98,7 @@ def enableProguardInReleaseBuilds = false
def getVersionCode = { -> def getVersionCode = { ->
new ByteArrayOutputStream().withStream { stdOut -> new ByteArrayOutputStream().withStream { stdOut ->
exec { exec {
commandLine "sh", "../../build_no.sh", "--tag" commandLine "sh", "../../scripts/build_no.sh"
standardOutput = stdOut standardOutput = stdOut
errorOutput = System.err errorOutput = System.err
} }
@ -111,12 +111,8 @@ def getVersionName = { ->
if (project.hasProperty("releaseVersion")) { if (project.hasProperty("releaseVersion")) {
return project.releaseVersion return project.releaseVersion
} }
version = new File('../VERSION').text
exec { return version.replaceAll("\\s","")
commandLine "git", "describe", "--tags", "--always", "--dirty=+"
standardOutput = stdOut
}
return stdOut.toString().replaceAll("\\s","")
} }
} }

View File

@ -22,18 +22,20 @@ INFO_PLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
if [[ $(git ls-files -m "StatusIm/Info.plist") = *"Info.plist"* ]]; then if [[ $(git ls-files -m "StatusIm/Info.plist") = *"Info.plist"* ]]; then
echo "version was set in Info.plist" echo "version was set in Info.plist"
else else
RELEASE_VERSION=$(cat ../VERSION)
# Build version (closest-tag-or-branch "-" commits-since-tag "-" short-hash dirty-flag) # 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]]") # 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> # 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" ] if [ $LATEST_TAG = "HEAD" ]
then COMMIT_COUNT=$(git rev-list --count HEAD) then COMMIT_COUNT=$(git rev-list --count HEAD)
LATEST_TAG="0.0.$COMMIT_COUNT" LATEST_TAG="0.0.$COMMIT_COUNT"
COMMIT_COUNT_SINCE_TAG=0 COMMIT_COUNT_SINCE_TAG=0
else 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 LATEST_TAG=${LATEST_TAG##v} # Remove the "v" from the front of the tag
fi fi
if [ $COMMIT_COUNT_SINCE_TAG = 0 ]; then if [ $COMMIT_COUNT_SINCE_TAG = 0 ]; then