-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
executable file
·37 lines (26 loc) · 1.06 KB
/
entrypoint.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
#!/bin/sh -l
echo "⭐️ Start"
echo "⭐️ Configure git"
apk add jq
COMMIT_EMAIL=`jq '.pusher.email' ${GITHUB_EVENT_PATH}`
COMMIT_NAME=`jq '.pusher.name' ${GITHUB_EVENT_PATH}`
COMMIT_MESSAGE=`jq '.commits[0].message' ${GITHUB_EVENT_PATH}`
git config --global user.email "${COMMIT_EMAIL}"
git config --global user.name "${COMMIT_NAME}"
REPOSITORY_PATH="https://${GITHUB_ACCESS_TOKEN}@github.com/$GITHUB_PAGES_REPO_AUTHOR/$GITHUB_PAGES_REPO_NAME.git"
echo "⭐️ Clone $GITHUB_PAGES_REPO_NAME"
cd $GITHUB_WORKSPACE
git clone $REPOSITORY_PATH
echo "⭐️ Clean old files by running $GITHUB_PAGES_CLEANUP_SCRIPT"
cd ./$GITHUB_PAGES_REPO_NAME
eval "$GITHUB_PAGES_CLEANUP_SCRIPT"
echo "⭐️ Copy build from $PROJECT_BUILD_FOLDER"
cd ../$PROJECT_BUILD_FOLDER
cp -R * ../$GITHUB_PAGES_REPO_NAME
echo "⭐️ Commit changes with message: $COMMIT_MESSAGE"
cd ../$GITHUB_PAGES_REPO_NAME
git add .
git commit -m "Release: $COMMIT_MESSAGE"
echo "⭐️ Push changes to $GITHUB_PAGES_RELEASE_BRANCH"
git push $REPOSITORY_PATH $GITHUB_PAGES_RELEASE_BRANCH
echo "⭐️ Finish"