forked from nix-community/nixpkgs-fmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·51 lines (39 loc) · 1.05 KB
/
deploy.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
#!/usr/bin/env bash
#
# Make sure to run wasm/build.sh before running this script
set -euo pipefail
## Functions ##
run() {
echo
echo "$ ${*@Q}" >&2
"$@"
}
## Main ##
[email protected]:nix-community/nixpkgs-fmt.git
workdir=$(mktemp -d)
cleanup() {
rm -rf "$workdir"
}
trap cleanup EXIT
if [[ -n "${DEPLOY_SSH_KEY:-}" ]]; then
echo "DEPLOY_SSH_KEY found"
ssh_key_path=$workdir/ssh_key
echo "$DEPLOY_SSH_KEY" | base64 -d > "$ssh_key_path"
run chmod 0600 "$ssh_key_path"
export GIT_SSH_COMMAND="ssh -i '$ssh_key_path'"
fi
run git clone --depth=1 --branch=gh-pages "$origin_url" "$workdir/repo"
run rsync -rl --exclude .git --delete wasm/ "$workdir/repo"
run rm -f "$workdir/repo/pkg/.gitignore"
run cd "$workdir/repo"
run git add -A .
if run git diff-index --quiet --cached HEAD -- ; then
echo "Found no changes to publish, exiting"
# no staged changes found
exit
fi
run git config user.name "CI"
run git config user.email "[email protected]"
run git commit --message "."
run git show --stat-count=10 HEAD
run git push -f origin gh-pages