Skip to content

Commit

Permalink
Add script for easy static site deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
vlucas committed May 17, 2024
1 parent 4558191 commit a0b7440
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Binary file removed .DS_Store
Binary file not shown.
27 changes: 27 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
GIT_BRANCH=$(git symbolic-ref -q HEAD)
GIT_REPO_URL=$(git config --get remote.origin.url)
BUILD_FOLDER=".build"

# Build
# npm run build

# Deploy & setup
cd $BUILD_FOLDER
rm .DS_Store
git init .
git remote add origin $GIT_REPO_URL
git checkout -b gh-pages || (echo "Cannot chekout gh-pages branch!" && exit 1)
# git pull origin gh-pages --rebase || (echo "Unable to pull remote changes on gh-pages branch!" && exit 1)

# Add CNAME file if present
cp ../CNAME .

# Ensure static assets can be served properly
touch .nojekyll

git add .
git commit -am "Static site deploy"
git push origin gh-pages --force
cd ..
rm -rf $BUILD_FOLDER

0 comments on commit a0b7440

Please sign in to comment.