Created
February 2, 2024 14:13
-
-
Save singiamtel/b80e8da85671110d3a7ed279d40ce102 to your computer and use it in GitHub Desktop.
Basic deploy script to integrate with GH actions. Currently used in crob.at
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
#!/bin/bash | |
# Original author: https://github.com/pkmn/ai/blob/main/deploy | |
set -euxo pipefail | |
# Save our current commit to use for comparison later | |
HEAD=$(git rev-parse HEAD) | |
# Pull down latest code | |
git pull origin master | |
# Update dependencies if package.json has changed | |
# This can break if: | |
# - You mess with the server repo manually | |
# - Your repo has broken dependencies/devDependencies separation | |
git diff --quiet $HEAD package.json >/dev/null || | |
npm install --omit=dev --silent | |
npm run build | |
pm2 restart 0 # Change this to your pm2 process name | |
# Reload proxy server if the config has changed | |
git diff --quiet $HEAD infra/Caddyfile || | |
sudo systemctl reload caddy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment