forked from Hammerspoon/Spoons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh_actions_publish.sh
executable file
·35 lines (28 loc) · 1.09 KB
/
gh_actions_publish.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
#!/bin/bash
if [ "$GITHUB_ACTIONS" != "true" ]; then
echo "This script should only be run as part of a GitHub Action"
exit 1
fi
set -x
set -eu
# Find the Spoons that have been modified
SPOONS=$(cat "${HOME}/files.json" | jq -r -c '.[] | select(contains(".lua"))' | sed -e 's#^Source/\(.*\).spoon/.*#\1#' | sort | uniq)
if [ "${SPOONS}" == "" ]; then
echo "No Spoons modified, skipping docs rebuild"
exit 0
fi
git config --global user.email "[email protected]"
git config --global user.name "Spoons GitHub Bot"
while IFS= read -r SPOON ; do
/usr/bin/python3 ./hammerspoon/scripts/docs/bin/build_docs.py -e ./hammerspoon/scripts/docs/templates/ -o Source/${SPOON}.spoon/ -j -n Source/${SPOON}.spoon/
rm Source/${SPOON}.spoon/docs_index.json
git add Source/${SPOON}.spoon/docs.json
git commit -am "Generate docs for ${SPOON}" || true
rm -f Spoons/${SPOON}.spoon.zip
make
git add Spoons/${SPOON}.spoon.zip
git commit -am "Add binary package for ${SPOON}."
./build_docs.sh
git add docs
git commit --allow-empty -am "Update docs"
done <<< "${SPOONS}"