Skip to content

Commit

Permalink
fix(FEC-9495): travis ping to jenkins for deployment (#294)
Browse files Browse the repository at this point in the history
add ping to Jenkins for canary and tag release, and change the dist creation to happened after every commit for canary versions
  • Loading branch information
Yuvalke authored May 5, 2020
1 parent 8d9a418 commit 871b096
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
60 changes: 57 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,60 @@ before_install:
- export DISPLAY=:99.0

script:
- npm run eslint
- npm run flow
- npm run test
- yarn install

stages:
- Tests
- Release canary
- Release

jobs:
fast_finish: true
include:
# https://docs.travis-ci.com/user/build-stages/deploy-github-releases/
# publish canary package if on master
- stage: Release
if: (tag IS present)
name: "Release"
script:
- chmod +x ./scripts/after_deploy.sh
- ./scripts/after_deploy.sh "$TRAVIS_TAG" "$JENKINS_TAG_TOKEN"
# https://docs.travis-ci.com/user/build-stages/deploy-github-releases/
# publish canary package if on master
- stage: Release canary
if: (branch = master) AND (type != pull_request) AND commit_message !~ /^chore\(release\)/ AND commit_message !~ /^(chore).*(update dist)$/
name: "Release canary"
script:
- 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}"
- currentVersion=$(npx -c 'echo "$npm_package_version"')
- commitNumberAfterTag=$(git rev-list `git rev-list --tags --no-walk --max-count=1`..HEAD --count)
- 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
- yarn run build:ovp && yarn run build:ott && npm run commit:dist
- echo $newVersion
- chmod +x ./scripts/after_deploy.sh
- ./scripts/after_deploy.sh "${newVersion}" "$JENKINS_CANARY_TOKEN"
# Required tests
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running lint"
script:
- npm run eslint
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running Flow type check"
script:
- npm run flow
- stage: Tests
if: (branch = master) OR (tag IS present) OR (type = pull_request)
name: "Running unit tests"
script:
- npm run test
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
"devMode": {},
"releaseMode": []
},
"standard-version": {
"scripts": {
"postbump": "yarn run build:ovp && yarn run build:ott && npm run commit:dist"
}
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
Expand Down
2 changes: 2 additions & 0 deletions scripts/after_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/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

0 comments on commit 871b096

Please sign in to comment.