]> git.lizzy.rs Git - rust.git/blob - .github/deploy.sh
59a7cdae866ef9e7047c247401e080557852d34b
[rust.git] / .github / deploy.sh
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 python ./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 current/ to it"
15   cp -r out/master "out/$TAG_NAME"
16   rm -f out/current
17   ln -s "$TAG_NAME" out/current
18 fi
19
20 # Generate version index that is shown as root index page
21 cp util/gh-pages/versions.html out/index.html
22
23 echo "Making the versions.json file"
24 python ./util/versions.py out
25
26 cd out
27 # Now let's go have some fun with the cloned repo
28 git config user.name "GHA CI"
29 git config user.email "gha@ci.invalid"
30
31 if git diff --exit-code --quiet; then
32   echo "No changes to the output on this push; exiting."
33   exit 0
34 fi
35
36 git add .
37 git commit -m "Automatic deploy to GitHub Pages: ${SHA}"
38
39 git push "$SSH_REPO" "$TARGET_BRANCH"