]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #!/bin/bash |
2 | ||
3 | set -ex | |
4 | ||
5 | echo "Removing the current docs for master" | |
6 | rm -rf out/master/ || exit 0 | |
7 | ||
8 | echo "Making the docs for master" | |
9 | mkdir out/master/ | |
10 | cp util/gh-pages/index.html out/master | |
11 | python3 ./util/export.py out/master/lints.json | |
12 | ||
13 | if [[ -n $TAG_NAME ]]; then | |
14 | echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it" | |
15 | cp -r out/master "out/$TAG_NAME" | |
16 | rm -f out/stable | |
17 | ln -s "$TAG_NAME" out/stable | |
18 | fi | |
19 | ||
20 | if [[ $BETA = "true" ]]; then | |
21 | echo "Update documentation for the beta release" | |
22 | cp -r out/master/* out/beta | |
23 | fi | |
24 | ||
25 | # Generate version index that is shown as root index page | |
26 | cp util/gh-pages/versions.html out/index.html | |
27 | ||
28 | echo "Making the versions.json file" | |
29 | python3 ./util/versions.py out | |
30 | ||
31 | cd out | |
32 | # Now let's go have some fun with the cloned repo | |
33 | git config user.name "GHA CI" | |
34 | git config user.email "gha@ci.invalid" | |
35 | ||
36 | if [[ -n $TAG_NAME ]]; then | |
37 | # track files, so that the following check works | |
38 | git add --intent-to-add "$TAG_NAME" | |
39 | if git diff --exit-code --quiet -- $TAG_NAME/; then | |
40 | echo "No changes to the output on this push; exiting." | |
41 | exit 0 | |
42 | fi | |
43 | # Add the new dir | |
44 | git add "$TAG_NAME" | |
45 | # Update the symlink | |
46 | git add stable | |
47 | # Update versions file | |
48 | git add versions.json | |
49 | git commit -m "Add documentation for ${TAG_NAME} release: ${SHA}" | |
50 | elif [[ $BETA = "true" ]]; then | |
51 | if git diff --exit-code --quiet -- beta/; then | |
52 | echo "No changes to the output on this push; exiting." | |
53 | exit 0 | |
54 | fi | |
55 | git add beta | |
56 | git commit -m "Automatic deploy to GitHub Pages (beta): ${SHA}" | |
57 | else | |
58 | if git diff --exit-code --quiet; then | |
59 | echo "No changes to the output on this push; exiting." | |
60 | exit 0 | |
61 | fi | |
62 | git add . | |
63 | git commit -m "Automatic deploy to GitHub Pages: ${SHA}" | |
64 | fi | |
65 | ||
66 | git push "$SSH_REPO" "$TARGET_BRANCH" |