-
Notifications
You must be signed in to change notification settings - Fork 30
/
build-docs.sh
executable file
·57 lines (36 loc) · 1.13 KB
/
build-docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash -ex
VERSION=$1
if [ -z "$VERSION" ]; then
echo "Expected a version as the first argument."
exit 1
fi
# Build doc files, they appear in ./output.
CONFIGURATION=Release
FRAMEWORK=netstandard2.0
INPUT_DIR="./doc"
OUTPUT_DIR="./output"
rm -rf .fsdocs $OUTPUT_DIR
dotnet build -c $CONFIGURATION -f $FRAMEWORK ./src/Hedgehog
dotnet fsdocs build \
--input $INPUT_DIR \
--property Configuration=$CONFIGURATION,TargetFramework=$FRAMEWORK \
--strict
# Get the artifacts into the `gh-pages` branch.
REPO_BRANCH="gh-pages"
REPO_URL="[email protected]:hedgehogqa/fsharp-hedgehog.git"
TEMP_DIR="temp/$REPO_BRANCH"
# Remove temp directory.
rm -rf $TEMP_DIR
mkdir -p $TEMP_DIR
# Clone our repo's `gh-pages` branch into the temp directory.
pushd $TEMP_DIR
git clone -b $REPO_BRANCH $REPO_URL .
find . -maxdepth 1 ! -path '*.git*' ! -path . -exec rm -rf {} \;
popd
# Copy all artifacts into the temp directory, and commit.
cp -r $OUTPUT_DIR/* $TEMP_DIR
pushd $TEMP_DIR
git add .
git commit -m "Update generated documentation for version $VERSION"
git push # `gh-pages` should be a tracking branch for origin/gh-pages.
popd