File tree 2 files changed +45
-0
lines changed 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 9
9
os : ubuntu-20.04
10
10
tools :
11
11
python : " 3.9"
12
+ jobs :
13
+ pre_build :
14
+ - bash docs/prebuild.sh
12
15
13
16
# Build documentation in the docs/ directory with Sphinx
14
17
sphinx :
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ #
3
+ # Replace place holders for http_archive attrs for rules_haskell with actual values
4
+ #
5
+
6
+ function die() {
7
+ echo " error: $* "
8
+ exit 1
9
+ } >&2
10
+
11
+ set -euo pipefail || die " cannot set options"
12
+
13
+ function get_sha256() {
14
+ curl -L " $1 " | python -uc ' import hashlib, sys; print(hashlib.sha256(sys.stdin.buffer.read()).hexdigest())'
15
+ }
16
+
17
+ if [[ " ${READTHEDOCS_VERSION_TYPE} " == branch && " ${READTHEDOCS_VERSION_NAME} " == master ]]; then
18
+ # a commit was pushed to the master branch
19
+ url=" https://github.com/tweag/rules_haskell/archive/${READTHEDOCS_GIT_COMMIT_HASH} .tar.gz"
20
+ hash=$( get_sha256 " $url " )
21
+ sed -i \
22
+ -e ' /name = "rules_haskell"/,/url = "/{' \
23
+ -e ' s%x\{64\}%' " ${hash} " ' %; ' \
24
+ -e ' s%/releases/download/vM[.]NN/rules_haskell-%/archive/%' \
25
+ -e ' s%M[.]NN%' " ${READTHEDOCS_GIT_COMMIT_HASH} " ' %g ' \
26
+ -e ' }' \
27
+ docs/haskell-use-cases.rst
28
+ elif [[ " ${READTHEDOCS_VERSION_TYPE} " == tag && " ${READTHEDOCS_GIT_IDENTIFIER} " == v[0-9]* ]]; then
29
+ # a version tag was pushed
30
+ version=" ${READTHEDOCS_GIT_IDENTIFIER# v} "
31
+ url=" https://github.com/tweag/rules_haskell/releases/download/v${version} /rules_haskell-${version} .tar.gz"
32
+ hash=$( get_sha256 " $url " )
33
+
34
+ sed -i \
35
+ -e ' /name = "rules_haskell"/,/url = "/{' \
36
+ -e ' s%x\{64\}%' " ${hash} " ' %; ' \
37
+ -e ' s%M[.]NN%' " ${version} " ' %g ' \
38
+ -e ' }' \
39
+ docs/haskell-use-cases.rst
40
+ else
41
+ die " cannot handle version type ${READTHEDOCS_VERSION_TYPE} / ${READTHEDOCS_VERSION_NAME} "
42
+ fi
You can’t perform that action at this time.
0 commit comments