create_form #48

Merged
esteban merged 42 commits from create_form into main 2026-07-28 11:50:56 +00:00
2 changed files with 59 additions and 8 deletions
Showing only changes of commit 25de7a53c1 - Show all commits

View File

@ -1,14 +1,51 @@
name: Centro del Reino de Paz y Justicia
name: Deploy cdrdpyj
on: [push]
on:
push:
branches: [staging, production]
jobs:
explore-gitea-actions:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: List files in the repository
- uses: actions/checkout@v4
- name: Set target dir & PM2 env
run: |
ls ${{ gitea.workspace }}
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
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

14
ecosystem.config.cjs Normal file
View File

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