-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
1. add the number of commits from the master. 2. releases from the no-master branch won’t be taken to beta/latest release. 3. curl request check failure. 4. don't stop the release after conventional-github-releaser failed. 5. update dependencies before tests so they'll be included
- Loading branch information
Showing
3 changed files
with
105 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
#!/bin/bash | ||
curl -k -d "{'version':$1}" -H "Content-Type: application/json" -X POST https://jenkins.ovp.kaltura.com/generic-webhook-trigger/invoke?token=$2 | ||
curl -k -d "{'version':$1}" -H "Content-Type: application/json" -X POST https://jenkins-central.prod.ovp.kaltura.com/generic-webhook-trigger/invoke?token=$2 | ||
set -x | ||
curl ifconfig.me | ||
|
||
#!/bin/bash | ||
HTTP_SUCCESS=false | ||
|
||
currentVersion=$(npx -c 'echo "$npm_package_version"') | ||
echo "$currentVersion" | ||
|
||
TAGGED_BRANCH=$(git ls-remote origin | sed -n "\|$TRAVIS_COMMIT\s\+refs/heads/|{s///p}") | ||
UPDATE_SCHEMA=true | ||
if [ "$TAGGED_BRANCH" != "master" ]; then | ||
UPDATE_SCHEMA=false | ||
fi | ||
|
||
for i in {1..3}; do | ||
echo "Try number $i for pinging Jenkins...\n" | ||
HTTP_CODE=$(curl -k -d "{'version':$currentVersion, 'schema_type': 'playerV3Versions', 'update_schema': $UPDATE_SCHEMA}" -H "Content-Type: application/json" --silent --output /dev/stderr --write-out "%{http_code}" --fail -X POST https://jenkins-central.prod.ovp.kaltura.com/generic-webhook-trigger/invoke?token=$1) | ||
STATUS_CODE=$? | ||
echo "Request return with http code $HTTP_CODE and curl finished with status code $STATUS_CODE" | ||
if [ "$HTTP_CODE" -eq 200 ] && [ "$STATUS_CODE" -eq 0 ]; then | ||
HTTP_SUCCESS=true | ||
break | ||
fi | ||
done | ||
|
||
echo "Jenkins ping success status - $HTTP_SUCCESS" | ||
|
||
if [ "$HTTP_SUCCESS" = true ]; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
# https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps | ||
set -ev | ||
yarn install | ||
|
||
if [[ "$TRAVIS_BRANCH" = "master" ]] && [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]] && [[ ! "$TRAVIS_COMMIT_MESSAGE" =~ ^(chore).*(update dist)$ ]] && [[ ! "$TRAVIS_COMMIT_MESSAGE" =~ ^chore\(release\) ]]; then | ||
echo "Prepare Canary" | ||
yarn upgrade @playkit-js/playkit-js@canary | ||
yarn upgrade @playkit-js/playkit-js-dash@canary | ||
yarn upgrade @playkit-js/playkit-js-hls@canary | ||
yarn upgrade @playkit-js/playkit-js-ui@canary | ||
yarn upgrade playkit-js-providers@https://github.com/kaltura/playkit-js-providers.git#master | ||
fi | ||
|
||
if [ "${TRAVIS_MODE}" = "lint" ]; then | ||
yarn run eslint | ||
elif [ "${TRAVIS_MODE}" = "flow" ]; then | ||
yarn run flow | ||
elif [ "${TRAVIS_MODE}" = "unitTests" ]; then | ||
yarn run test | ||
elif [ "${TRAVIS_MODE}" = "release" ] || [ "${TRAVIS_MODE}" = "releaseCanary" ]; then | ||
if [ "${TRAVIS_MODE}" = "releaseCanary" ]; then | ||
echo "Run standard-version" | ||
yarn run release --prerelease canary --skip.commit=true --skip.tag=true | ||
sha=$(git rev-parse --verify --short HEAD) | ||
echo "Current sha ${sha}" | ||
commitNumberAfterTag=$(git rev-list `git rev-list --tags --no-walk --max-count=1`..HEAD --count) | ||
echo "Number of commit from last tag ${commitNumberAfterTag}" | ||
currentVersion=$(npx -c 'echo "$npm_package_version"') | ||
echo "Current version ${currentVersion}" | ||
newVersion=$(echo $currentVersion | sed -e "s/canary\.[[:digit:]]/canary.${commitNumberAfterTag}-${sha}/g") | ||
echo "New version ${newVersion}" | ||
sed -iE "s/$currentVersion/$newVersion/g" package.json | ||
sed -iE "s/$currentVersion/$newVersion/g" CHANGELOG.md | ||
rm package.jsonE | ||
rm CHANGELOG.mdE | ||
echo "Building..." | ||
yarn run build:ovp && yarn run build:ott && npm run commit:dist | ||
echo "Finish building" | ||
git push https://$GH_TOKEN@github.com/kaltura/kaltura-player-js "master" > /dev/null 2>&1 | ||
echo "Push Build to origin" | ||
else | ||
echo "Run conventional-github-releaser" | ||
#ignore error to make sure release won't get stuck | ||
conventional-github-releaser -p angular -t $GH_TOKEN || true | ||
fi | ||
else | ||
echo "Unknown travis mode: ${TRAVIS_MODE}" 1>&2 | ||
exit 1 | ||
fi |