Skip to content

Commit

Permalink
Merge pull request #67 from pumbas600/ci/fix-deploy-script
Browse files Browse the repository at this point in the history
ci: 🚧 Fix npm command not being found in GH actions
  • Loading branch information
pumbas600 authored Apr 4, 2024
2 parents 6861fb1 + b737754 commit 71d2d29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ jobs:
key: ${{ secrets.SSH_KEY }}
script: |
cd services/github-contributions
chmod +x scripts/deploy.sh
./scripts/deploy.sh
10 changes: 8 additions & 2 deletions scripts/deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@

processName="github-contributions"

# exit when any command fails
# Exit when any command fails
set -e

git reset --hard --quiet

echo "Pulling from origin"
git pull --quiet

# Ensure that npm can be found by GitHub actions
# See: https://gist.github.com/danielwetan/4f4db933531db5dd1af2e69ec8d54d8a?permalink_comment_id=4057972
echo "Setting up NVM"
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh

export NODE_ENV=production

echo "Installing dependencies"
Expand All @@ -21,7 +27,7 @@ echo "Building"
npm run build

echo "Killing old instance"
# deletion is allowed to fail, since the process might not have been running previously
# Deletion is allowed to fail, since the process might not have been running previously
pm2 delete $processName --silent || true

echo "Starting new instance"
Expand Down

0 comments on commit 71d2d29

Please sign in to comment.