fix: action pipe #6
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
name: Deploy CI/CD Pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
- name: Install dependencies | |
run: npm ci | |
- name: Create .env file | |
run: | | |
echo "GROQ_API_KEY=${{ secrets.secrets}}" > .env | |
- name: Sync code to application directory | |
run: | | |
rsync -avz --delete \ | |
--exclude 'node_modules' \ | |
--exclude '.git' \ | |
--exclude '.gitignore' \ | |
--exclude 'README.md' \ | |
--exclude '.github' \ | |
--exclude 'logs' \ | |
./ /home/muhammedr7025/server | |
- name: Install dependencies in app directory | |
working-directory: /home/muhammedr7025/server | |
run: npm ci | |
- name: Install PM2 globally if not present | |
run: | | |
if ! command -v pm2 &> /dev/null; then | |
npm install pm2 -g | |
fi | |
- name: Restart PM2 process | |
working-directory: /home/muhammedr7025/server | |
run: pm2 restart ecosystem.config.js --env production |