-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Showing
2 changed files
with
8 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
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,28 +1,25 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
TARGET_BRANCH=$1 | ||
BUILD_DIR=$2 | ||
|
||
if [ -z "$TARGET_BRANCH" ]; then | ||
if [ -z "$INPUT_TARGET_BRANCH" ]; then | ||
echo "⛔️ Target branch not defined" | ||
exit 1 | ||
fi | ||
if [ ! -d "$BUILD_DIR" ]; then | ||
if [ ! -d "$INPUT_BUILD_DIR" ]; then | ||
echo "⛔️ Build dir does not exist" | ||
exit 1 | ||
fi | ||
|
||
echo "🏃 Deploying $BUILD_DIR directory to $TARGET_BRANCH branch" | ||
cd "$BUILD_DIR" | ||
echo "🏃 Deploying $INPUT_BUILD_DIR directory to $INPUT_TARGET_BRANCH branch" | ||
cd "$INPUT_BUILD_DIR" | ||
|
||
git init | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git add . | ||
git commit --allow-empty -m 'Deploy to GitHub pages' | ||
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:$TARGET_BRANCH | ||
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:${INPUT_TARGET_BRANCH} | ||
rm -rf .git | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
echo "🎉 Content of $BUILD_DIR has been deployed to GitHub Pages." | ||
echo "🎉 Content of $INPUT_BUILD_DIR has been deployed to GitHub Pages." |