Skip to content

Commit

Permalink
ci(travis): add readme-sync integration
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlostong committed May 26, 2020
1 parent 35eb16d commit 6ae1822
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: minimal
env: GO111MODULE=on
git:
depth: 1
depth: false
install:
- eval "$(gimme)"
stages:
- name: 'Lint markdown files'
- 'Readme-sync'
- 'Lint markdown files'
- 'Lint'
- 'Unit test'
- 'Benchmark test'
Expand All @@ -19,8 +20,6 @@ jobs:
install: gem install awesome_bot
script:
- find . -type f -name '*.md' -exec awesome_bot {} \;
notifications:
email: false

# - stage: 'Lint markdown files'
# os: linux
Expand Down Expand Up @@ -96,3 +95,23 @@ jobs:
addons:
srcclr: true
script: go get -v -d ./...

- stage: 'Readme-sync'
name: 'run script if changes are detected in docs/'
cache: false

# translation: if we're merging into master branch...
if: type = push AND branch = master

language: node_js
install:
- mkdir $HOME/readme-sync2 && pushd $HOME/readme-sync2 && git init && git pull https://$CI_USER_TOKEN@github.com/optimizely/readme-sync2.git && popd
- source ~/.nvm/nvm.sh && cd $HOME/readme-sync2 && nvm install && npm install
# this preps the input directory for readme-sync script
- mkdir -p $HOME/readme-sync2/docs/sdk-reference-guides
# ${TRAVIS_REPO_SLUG#optimizely/} translates to go-sdk
- ln -s $TRAVIS_BUILD_DIR/docs $HOME/readme-sync2/docs/sdk-reference-guides/${TRAVIS_REPO_SLUG#optimizely/}
script:
# we need to be in $TRAVIS_BUILD_DIR in order to run the following git diff properly
- cd $TRAVIS_BUILD_DIR
- git diff --quiet $TRAVIS_COMMIT_RANGE -- docs/ || ( cd $HOME/readme-sync2 && npx ts-node sync/index.ts --apiKey $README_SYNC_API_KEY --version 4.0 --docs docs/ )

0 comments on commit 6ae1822

Please sign in to comment.