diff --git a/deploy.ps1 b/deploy.ps1 deleted file mode 100644 index 7625696..0000000 --- a/deploy.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -# Build -yarn run build - -# Navigate into the build output directory -cd dist - -# Deploying to a custom domain -echo 'profile.hydev.org' > CNAME - -git init -git add -A -git commit -m 'deploy' -git push -f https://github.com/hykilpikonna/home-page.git master:gh-pages -cd .. diff --git a/deploy.sh b/deploy.sh index ba83678..45d759f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,14 +6,20 @@ set -e # Build yarn run build -# Navigate into the build output directory -cd dist +DEPL="/etc/nginx/hres/aza.moe" -# Deploying to a custom domain -echo 'profile.hydev.org' > CNAME +# Update static files (since mv is way faster than cp, we use a tmp folder) +if [ -d "$DEPL.tmp1" ]; then + sudo rm -rf "$DEPL.tmp1" +fi +cp -r dist "$DEPL.tmp1" +if [ -d "$DEPL" ]; then + sudo mv "$DEPL" "$DEPL.del" +fi +sudo mv "$DEPL.tmp1" "$DEPL" +if [ -d "$DEPL.del" ]; then + sudo rm -rf "$DEPL.del" +fi -git init -git add -A -git commit -m 'deploy' -git push -f git@github.com:hykilpikonna/home-page.git master:gh-pages -cd - +# Reload nginx +sudo nginx -t && sudo systemctl restart nginx