From b95056f3cea850f3cca01198c4e749d0fabf7bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 2 Jul 2020 19:04:35 +0200 Subject: [PATCH] ci: fix what version is set for iOS PR builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- .gitignore | 1 + ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.combined | 2 +- ci/Jenkinsfile.ios | 2 +- ci/Jenkinsfile.linux | 2 +- ci/Jenkinsfile.macos | 2 +- ci/Jenkinsfile.nix-cache | 2 +- ci/Jenkinsfile.windows | 2 +- ci/tools/Jenkinsfile.fastlane-clean | 2 +- ci/tools/Jenkinsfile.playstore-meta | 2 +- ios/StatusIm.xcodeproj/project.pbxproj | 4 ++-- ios/scripts/set_xcode_version.sh | 30 +++++++++++++------------- 12 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 00e329e944..02da974ba7 100644 --- a/.gitignore +++ b/.gitignore @@ -103,6 +103,7 @@ Statusgo.framework /ios/Pods/ /ios/StatusIm.xcworkspace /ios/react-native-xcode.log +/ios/set_xcode_version.log .ruby-version status-e2e/ diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 1521a71a2b..9f9a750b55 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 77460f8789..4608ca1540 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index c42fc947ca..ff00bf723a 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'macos-xcode-11.5' } diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 02b42a74c1..5659be115c 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index 7aefe2528d..539f1d69dd 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'macos-xcode-11.5' } diff --git a/ci/Jenkinsfile.nix-cache b/ci/Jenkinsfile.nix-cache index 6de9bd4519..d4baf4aab1 100644 --- a/ci/Jenkinsfile.nix-cache +++ b/ci/Jenkinsfile.nix-cache @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label params.AGENT_LABEL } diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index f5dc513466..e3f3df5d66 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'linux' } diff --git a/ci/tools/Jenkinsfile.fastlane-clean b/ci/tools/Jenkinsfile.fastlane-clean index 422abd54ea..2f1cfd9ce0 100644 --- a/ci/tools/Jenkinsfile.fastlane-clean +++ b/ci/tools/Jenkinsfile.fastlane-clean @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'macos' } diff --git a/ci/tools/Jenkinsfile.playstore-meta b/ci/tools/Jenkinsfile.playstore-meta index 5ce2d0b357..27bffb207c 100644 --- a/ci/tools/Jenkinsfile.playstore-meta +++ b/ci/tools/Jenkinsfile.playstore-meta @@ -1,4 +1,4 @@ -library 'status-react-jenkins@v1.1.8' +library 'status-react-jenkins@v1.1.9' pipeline { agent { label 'linux' } diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index 4ef840cccf..aed6db560b 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -678,7 +678,7 @@ ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "#!/usr/bin/env bash\n\nsource \"${PROJECT_DIR}/scripts/set_xcode_version.sh\""; + shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./set_xcode_version.log 2>&1"; }; 3AAD2AD824A3A60E0075D594 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; @@ -754,7 +754,7 @@ ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "#!/usr/bin/env bash\n\nsource \"${PROJECT_DIR}/scripts/set_xcode_version.sh\""; + shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./set_xcode_version.log 2>&1"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/scripts/set_xcode_version.sh b/ios/scripts/set_xcode_version.sh index 6f9aeb2d84..1cda42c8f8 100755 --- a/ios/scripts/set_xcode_version.sh +++ b/ios/scripts/set_xcode_version.sh @@ -6,29 +6,29 @@ # To use this script in Xcode, add the script's path to a "Run Script" build # phase for your application target. +set -x set -o errexit set -o nounset # First, check for git in $PATH hash git 2>/dev/null || { echo >&2 "Git required, not installed. Aborting build number update script."; exit 0; } -# Alternatively, we could use Xcode's copy of the Git binary, -# but old Xcodes don't have this. -#GIT=$(xcrun -find git) - -# Run Script build phases that operate on product files of the target that defines them should use the value of this build setting [TARGET_BUILD_DIR]. But Run Script build phases that operate on product files of other targets should use ?BUILT_PRODUCTS_DIR? instead. +# Run Script build phases that operate on product files of the target +# that defines them should use the value of this build setting [TARGET_BUILD_DIR]. +# But Run Script build phases that operate on product files of other targets should use ?BUILT_PRODUCTS_DIR? instead. 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_NO=$(bash ../scripts/version/build_no.sh) - - # For debugging: - echo "SHORT VERSION: $RELEASE_VERSION" - echo "BUILD NO: $BUILD_NO" - - /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $BUILD_NO" "$INFO_PLIST" 2>/dev/null || /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NO" "$INFO_PLIST" - /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $RELEASE_VERSION" "$INFO_PLIST" + exit 0 fi + +RELEASE_VERSION=$(cat ../VERSION) +BUILD_NO=$(bash ../scripts/version/build_no.sh) + +# For debugging: +echo "SHORT VERSION: ${RELEASE_VERSION}" +echo "BUILD NO: ${BUILD_NO}" + +/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NO}" "${INFO_PLIST}" +/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${RELEASE_VERSION}" "${INFO_PLIST}"