Compare commits

..

No commits in common. "f2923b6b3080180c3e349f4823c4f5d4a3d12b28" and "99f870808b7908c1c2dfe5243b80945864a87c7c" have entirely different histories.

2 changed files with 8 additions and 59 deletions

View File

@ -1,51 +1,14 @@
name: Deploy cdrdpyj
name: Centro del Reino de Paz y Justicia
on:
push:
branches: [staging, production]
on: [push]
jobs:
deploy:
explore-gitea-actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set target dir & PM2 env
- name: Check out repository code
uses: actions/checkout@v4
- name: List files in the repository
run: |
if [ "${{ gitea.ref_name }}" = "production" ]; then
echo "TARGET_DIR=/var/www/cdrdpyj" >> $GITHUB_ENV
echo "PM2_ENV=production" >> $GITHUB_ENV
else
echo "TARGET_DIR=/var/www/dev.cdrdjyp" >> $GITHUB_ENV
echo "PM2_ENV=staging" >> $GITHUB_ENV
fi
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Copy build to VPS
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
source: "dist/*,package.json,ecosystem.config.cjs"
target: "${{ env.TARGET_DIR }}"
- name: Restart PM2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
cd ${{ env.TARGET_DIR }}
pm2 reload ecosystem.config.cjs --env ${{ env.PM2_ENV }} --update-env || \
pm2 start ecosystem.config.cjs --env ${{ env.PM2_ENV }} --update-env
ls ${{ gitea.workspace }}
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."

View File

@ -1,14 +0,0 @@
module.exports = {
apps: [{
name: "cdrdpyj",
script: "dist/server/entry.mjs",
env: {
NODE_ENV: "staging",
PORT: 3310,
},
env_production: {
NODE_ENV: "production",
PORT: 3310,
}
}]
};