From 524a27674cbd9661efbb305af2852b5dd0f24066 Mon Sep 17 00:00:00 2001 From: Leo Arias Date: Tue, 28 Aug 2018 10:37:11 -0600 Subject: [PATCH] ci: trigger docs update on tag (#1186) --- .travis.yml | 8 ++++++++ scripts/ci/trigger_docs_update | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 scripts/ci/trigger_docs_update diff --git a/.travis.yml b/.travis.yml index 3ed321655..19994b1f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,14 @@ jobs: - stage: tests name: "static tests" script: npm run lint + - stage: update docs + if: tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ + addons: + apt: + packages: + - curl + script: + - ./scripts/ci/trigger_docs_update "${TRAVIS_TAG}" notifications: slack: diff --git a/scripts/ci/trigger_docs_update b/scripts/ci/trigger_docs_update new file mode 100755 index 000000000..47a6db642 --- /dev/null +++ b/scripts/ci/trigger_docs_update @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Trigger the job that will update the documentation website. +# Argument: +# version: the version of the new release. This should be a tag in the +# https://github.com/OpenZeppelin/openzeppelin-solidity repository. + +set -ev + +if [ "$#" -lt 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +readonly VERSION="$1" + +readonly BODY="{ + \"request\": { + \"branch\": \"master\", + \"config\": { + \"env\": [\"VERSION=${VERSION}\"] + } + } +}" + +curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token ${DOCS_TRAVIS_API_TOKEN}" \ + -d "${BODY}" \ + https://api.travis-ci.com/repo/OpenZeppelin%2Fopenzeppelin-docs/requests