-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish.sh
executable file
·45 lines (37 loc) · 1.04 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -e
if [ -z "$GH_TOKEN" ]
then
echo "You must provide the action with a GitHub Personal Access Token secret in order to deploy."
exit 1
fi
if [ -z "$COMMIT_EMAIL" ]
then
COMMIT_EMAIL="${GITHUB_ACTOR}@users.noreply.github.com"
fi
if [ -z "$COMMIT_NAME" ]
then
COMMIT_NAME="${GITHUB_ACTOR}"
fi
git config --global user.email "${COMMIT_EMAIL}"
git config --global user.name "${COMMIT_NAME}"
git config --global credential.helper "store --file=~/.git-credentials"
echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials
./gradlew build || EXIT_STATUS=$?
if [[ $EXIT_STATUS -ne 0 ]]; then
echo "Project Build failed"
exit $EXIT_STATUS
fi
git clone https://${GH_TOKEN}@github.com/${GITHUB_SLUG}.git -b gh-pages gh-pages --single-branch > /dev/null
cd gh-pages
cp -r ../build/launch/* .
#if git diff --quiet; then
# echo "No changes in Grails Forge UI"
#else
git add -A
git commit -a -m "Updating $GITHUB_SLUG gh-pages branch for Github Actions run:$GITHUB_RUN_ID"
git push origin HEAD
#fi
cd ..
rm -rf gh-pages
exit $EXIT_STATUS