-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d90a835
commit 6a28d87
Showing
5 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ jobs: | |
with: | ||
provider: 'github' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh_private_key: '' | ||
jekyll_src: './test_site' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
# Check if deploy to same branch | ||
if [ "${REPOSITORY}" = "${GITHUB_REPOSITORY}" ]; then | ||
if [ "${GITHUB_REF}" = "refs/heads/${BRANCH}" ]; then | ||
if [[ "${REPOSITORY}" = "${GITHUB_REPOSITORY}" ]]; then | ||
if [[ "${GITHUB_REF}" = "refs/heads/${BRANCH}" ]]; then | ||
echo "It's conflicted to deploy on same branch ${BRANCH}" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Tell GitHub Pages not to run Jekyll | ||
touch .nojekyll | ||
[ -n "$INPUT_CNAME" ] && echo "$INPUT_CNAME" > CNAME | ||
[[ -n "$INPUT_CNAME" ]] && echo "$INPUT_CNAME" > CNAME | ||
|
||
# Prefer to use SSH approach when SSH private key is provided | ||
if [[ -n "${SSH_PRIVATE_KEY}" ]]; then | ||
export GIT_SSH_COMMAND="ssh -i ${SSH_PRIVATE_KEY_PATH} \ | ||
-o StrictHostKeyChecking=no \ | ||
-o UserKnownHostsFile=/dev/null" | ||
REMOTE_REPO="git@github.com:${REPOSITORY}.git" | ||
else | ||
REMOTE_REPO="https://${ACTOR}:${TOKEN}@github.com/${REPOSITORY}.git" | ||
fi | ||
|
||
echo "Deploying to ${REPOSITORY} on branch ${BRANCH}" | ||
echo "Deploying to https://${ACTOR}:${TOKEN}@github.com/${REPOSITORY}.git" | ||
echo "Deploying to ${REMOTE_REPO}" | ||
|
||
REMOTE_REPO="https://${ACTOR}:${TOKEN}@github.com/${REPOSITORY}.git" && \ | ||
git config --global http.postBuffer 524288000 && \ | ||
git config --global init.defaultBranch main && \ | ||
git config --global init.defaultBranch main && \ | ||
git init && \ | ||
git config user.name "${ACTOR}" && \ | ||
git config user.email "${ACTOR}@users.noreply.github.com" && \ | ||
git add . && \ | ||
git commit -m "jekyll build from Action ${GITHUB_SHA}" && \ | ||
git push --force $REMOTE_REPO main:$BRANCH && \ | ||
fuser -k .git || rm -rf .git && \ | ||
(fuser -k .git || rm -rf .git) && \ | ||
cd .. | ||
|
||
exit $? | ||
PROVIDER_EXIT_CODE=$? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters