mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-15 02:17:32 +00:00
Merge pull request #2572 from keymanapp/chore/ci/increment-version-final
chore(ci): trigger builds after version increment
This commit is contained in:
commit
6fa74a332a
2 changed files with 58 additions and 5 deletions
|
|
@ -19,6 +19,8 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA
|
|||
. "$(dirname "$THIS_SCRIPT")/build-utils.sh"
|
||||
## END STANDARD BUILD SCRIPT INCLUDE
|
||||
|
||||
. "$(dirname "$THIS_SCRIPT")/trigger-builds.sh"
|
||||
|
||||
gitbranch=`git branch --show-current`
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
|
|
@ -59,7 +61,6 @@ fi
|
|||
# avoid transient errors
|
||||
git pull origin $base
|
||||
|
||||
|
||||
#
|
||||
# Run the increment + history refresh
|
||||
#
|
||||
|
|
@ -69,15 +70,19 @@ npm install
|
|||
npm run build:ts
|
||||
popd > /dev/null
|
||||
|
||||
pushd "$KEYMAN_ROOT"
|
||||
node resources/build/version/lib/index.js history version -t "$GITHUB_TOKEN" -b "$base" || (
|
||||
pushd "$KEYMAN_ROOT" > /dev/null
|
||||
ABORT=0
|
||||
node resources/build/version/lib/index.js history version -t "$GITHUB_TOKEN" -b "$base" || ABORT=1
|
||||
|
||||
if [[ $ABORT = 1 ]]; then
|
||||
echo "Skipping version increment from $VERSION: no recently merged pull requests were found"
|
||||
if [ ! -z "${TEAMCITY_VERSION-}" ]; then
|
||||
# Send TeamCity a build status
|
||||
echo "##teamcity[buildStatus status='SUCCESS' text='Skipping version increment from $VERSION: no recently merged pull requests were found']"
|
||||
fi
|
||||
exit 0
|
||||
)
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
#
|
||||
# Push the result
|
||||
|
|
@ -100,7 +105,17 @@ if [ "$action" == "commit" ]; then
|
|||
git branch -D "$branch"
|
||||
popd > /dev/null
|
||||
|
||||
echo "Version was incremented and pull request was created"
|
||||
#
|
||||
# Trigger builds for the previous version on TeamCity
|
||||
#
|
||||
|
||||
triggerBuilds
|
||||
|
||||
#
|
||||
# Done
|
||||
#
|
||||
|
||||
echo "Version was incremented and pull request was created, and builds were triggered"
|
||||
if [ ! -z "${TEAMCITY_VERSION-}" ]; then
|
||||
# Send TeamCity a build status
|
||||
echo "##teamcity[buildStatus status='SUCCESS' text='Version was incremented from $VERSION to $NEWVERSION and pull request was created']"
|
||||
|
|
|
|||
38
resources/build/trigger-builds.sh
Normal file
38
resources/build/trigger-builds.sh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Tell TeamCity to trigger new builds
|
||||
#
|
||||
|
||||
function triggerBuilds() {
|
||||
local base=`git branch --show-current`
|
||||
if [[ $base == master ]]; then
|
||||
local TEAMCITY_BUILDTYPES=( KeymanAndroid_Build Keyman_iOS_Master KeymanLinux_Master KeymanMac_Master Keyman_Build Keymanweb_Build )
|
||||
local TEAMCITY_VCS_ID=HttpsGithubComKeymanappKeyman
|
||||
elif [[ $base == beta ]]; then
|
||||
local TEAMCITY_BUILDTYPES=( KeymanAndroid_Beta Keyman_iOS_Beta KeymanLinux_Beta KeymanMac_Beta KeymanDesktop_Beta Keymanweb_Beta )
|
||||
local TEAMCITY_VCS_ID=Keyman_KeymanappKeymanBeta
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for TEAMCITY_BUILDTYPE in "${TEAMCITY_BUILDTYPES[@]}"; do
|
||||
triggerBuild $TEAMCITY_BUILDTYPE $TEAMCITY_VCS_ID
|
||||
done
|
||||
}
|
||||
|
||||
function triggerBuild() {
|
||||
local TEAMCITY_BUILDTYPE="$1"
|
||||
local TEAMCITY_VCS_ID="$2"
|
||||
|
||||
local GIT_OID=`git rev-parse HEAD`
|
||||
local TEAMCITY_SERVER=https://build.palaso.org
|
||||
|
||||
curl -s --header "Authorization: Bearer $TEAMCITY_TOKEN" \
|
||||
-X POST \
|
||||
-H "Content-Type: application/xml" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Origin: $TEAMCITY_SERVER" \
|
||||
$TEAMCITY_SERVER/app/rest/buildQueue \
|
||||
-d "<build><buildType id='$TEAMCITY_BUILDTYPE' /><lastChanges><change vcsRootInstance='$TEAMCITY_VCS_ID' locator='version:$GIT_OID,buildType:(id:$TEAMCITY_BUILDTYPE)'/></lastChanges></build>"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue