diff --git a/circle.yml b/circle.yml index 52c7e685..f0d119c9 100644 --- a/circle.yml +++ b/circle.yml @@ -66,4 +66,5 @@ deployment: # are updated from 1.6. - rm -rf docs/1.9 - ./tools/circleci/push-to-master.sh + - ./tools/circleci/trigger-trpl-pdf-ja.sh # - ./tools/circleci/publish-to-gh-pages.sh diff --git a/tools/circleci/trigger-trpl-pdf-ja.sh b/tools/circleci/trigger-trpl-pdf-ja.sh new file mode 100755 index 00000000..027038ed --- /dev/null +++ b/tools/circleci/trigger-trpl-pdf-ja.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# This script triggers a Travis CI build on trpl-ja-pdf to generates +# PDF files of TRPL. It does so by sending a request to Travis's API +# server. +# +# This script referes to the following mandatory and optional +# environment variables: +# +# - TRPL_JA_PDF_TRAVIS_AUTH_TOKEN (Mandatory): +# The auth token required by Travis CI web API. Since this +# variable carries a sensitive data, it should not be defined in +# circle.yml. Instead, it should be defined at Circle CI's web +# console at: +# https://circleci.com/gh/rust-lang-ja/the-rust-programming-language-ja/edit#env-vars +# +# To obtain a Travis auth token, follow the instructions on: +# https://docs.travis-ci.com/user/triggering-builds/ +# +# - TRPL_JA_PDF_GITHUB_ORG (Optional): +# The GitHub organization or user name of trpl-ja-pdf, default to +# `rust-lanu-ja`. To override it, define this variable at +# CirildCI's web console or in circle.yml. +# +# - TRPL_JA_PDF_GITHUB_REPO (Optional): +# The GitHub repository name of trpl-ja-pdf, default to +# `trpl-ja-pdf`. To override it, define this variable at +# CircleCI's web console or in circle.yml. +# +# - TRPL_JA_PDF_GITHUB_BRANCH (Optional): +# The GitHub branch of trpl-ja-pdf, default to `master`. To +# override it, define this variable at CircleCI's web console or +# in circle.yml. + +set -e + +if [ -z "${TRPL_JA_PDF_TRAVIS_AUTH_TOKEN+x}" ]; then + echo "ERROR: Environment variable TRPL_JA_PDF_TRAVIS_AUTH_TOKEN is undefined." + echo " If you want to trigger a Travis CI build for trpl-ja-pdf," + echo " please read comments in this script to define the variable." + exit 1 +fi + +GITHUB_ORG=${TRPL_JA_PDF_GITHUB_ORG:-rust-lang-ja} +GITHUB_REPO=${TRPL_JA_PDF_GITHUB_REPO:-trpl-ja-pdf} +GITHUB_BRANCH=${TRPL_JA_PDF_GITHUB_BRANCH:-master} + +set -u + +# Get the revision of current branch. +REVISION=$(git rev-parse --short HEAD) + +BUILD_PARAMS=$(cat <