This repository has been archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
13 changed files
with
3,573 additions
and
2,608 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
jq --version || { echo "⚠️ You must have jq installed on your machine (brew install jq)" ; exit 1; } | ||
|
||
cd $2 | ||
|
||
DEST=`jq -er ".ghpages" "$2/toolbox.json"` | ||
DIRECTORY="$2/${DEST%?}" | ||
BRANCH="gh-pages" | ||
CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | ||
|
||
# Check if the environment is ready for publishing =========================== | ||
if [[ $(git status -s) ]] | ||
then | ||
echo "⚠️ The working directory is dirty. Please commit any pending changes." | ||
exit 1; | ||
fi | ||
|
||
# Proceed ===================================================================== | ||
# yarn build --dev | ||
echo "backup dist content" | ||
echo $DIRECTORY | ||
mkdir "$DIRECTORY-tmp" | ||
cp -r $DIRECTORY/* "$DIRECTORY-tmp/" | ||
|
||
echo "Deleting dist" | ||
rm -rf $DIRECTORY | ||
mkdir $DIRECTORY | ||
git worktree prune | ||
rm -rf .git/worktrees/$DIRECTORY/ | ||
|
||
echo "Checking out $BRANCH branch into dist" | ||
git worktree add -B $BRANCH $DIRECTORY | ||
|
||
echo "Removing existing files" | ||
rm -rf $DIRECTORY/* | ||
|
||
echo "Generating dist using the backup" | ||
cp -r "$DIRECTORY-tmp"/* $DIRECTORY/ | ||
rm -rf "$DIRECTORY-tmp" | ||
|
||
echo "Updating $BRANCH branch" | ||
cd $DIRECTORY && git add --all && git commit -m "Publishing to $BRANCH (publish.sh)" | ||
git push --force origin $BRANCH --tags |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.