Skip to content

Commit

Permalink
ci: add coolify deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Epoxide committed Jun 30, 2024
1 parent 7f00aed commit 6ec7acf
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,7 @@ jobs:
concurrency:
group: production
cancel-in-progress: true
env:
DEPLOY_DIRECTORY: ${{ secrets.DEPLOY_DIRECTORY }}
DEPLOY_NVM_DIRECTORY: ${{ secrets.DEPLOY_NVM_DIRECTORY }}
steps:
- name: Configure SSH
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
- name: Trigger Coolify deployment
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/deploy
chmod 600 ~/.ssh/deploy
cat >>~/.ssh/config <<END
Host production
HostName $DEPLOY_HOST
User $DEPLOY_USER
IdentityFile ~/.ssh/deploy
StrictHostKeyChecking no
END
- name: Pull latest
run: ssh production "cd $DEPLOY_DIRECTORY && git checkout . && git pull"
- name: Install dependencies
run: ssh production "cd $DEPLOY_DIRECTORY && . $DEPLOY_NVM_DIRECTORY/nvm.sh --no-use && nvm use && npm install"
- name: Build
run: ssh production "cd $DEPLOY_DIRECTORY && . $DEPLOY_NVM_DIRECTORY/nvm.sh --no-use && nvm use && npm run build"
- name: Restart server
run: ssh production "cd $DEPLOY_DIRECTORY && . $DEPLOY_NVM_DIRECTORY/nvm.sh --no-use && nvm use && pm2 restart npm -- start"
curl --request GET '${{ secrets.COOLIFY_WEBHOOK_URL }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_API_TOKEN }}'

0 comments on commit 6ec7acf

Please sign in to comment.