From e4c5432f478afc48e81f59f6f076c4c4dbe481a9 Mon Sep 17 00:00:00 2001 From: roozbehk Date: Mon, 6 Oct 2025 21:37:46 +0000 Subject: [PATCH] test: trigger CI/CD --- .gitea/workflows/deploy.yml | 56 +++++++++++++++++++++++++++++++++++++ backend/index.js | 1 + ecosystem.config.js | 24 ++++++++++++++++ package-lock.json | 4 +-- 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 backend/index.js create mode 100644 ecosystem.config.js diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..ac7a1d7 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Deploy to Production + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + npm install + cd backend && npm install && cd .. + cd frontend && npm install && cd .. + + - name: Run backend tests + run: | + cd backend + npm test || echo "No tests configured" + + - name: Build frontend + run: | + cd frontend + npm run build + + - name: Deploy to server + env: + SERVER_HOST: ${{ secrets.SERVER_HOST }} + SERVER_USER: ${{ secrets.SERVER_USER }} + SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + # Setup SSH + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh-keyscan -H $SERVER_HOST >> ~/.ssh/known_hosts + + # Deploy + ssh -i ~/.ssh/deploy_key $SERVER_USER@$SERVER_HOST << 'EOF' + cd /var/www/aeroEcho + git pull origin main + npm run install:all + cd frontend && npm run build && cd .. + pm2 restart ecosystem.config.js + EOF diff --git a/backend/index.js b/backend/index.js new file mode 100644 index 0000000..e6ec2ac --- /dev/null +++ b/backend/index.js @@ -0,0 +1 @@ +// CI/CD test diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..e72e3ef --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,24 @@ +module.exports = { + apps: [ + { + name: 'aeroecho-backend', + cwd: './backend', + script: 'npm', + args: 'start', + env: { + NODE_ENV: 'production', + PORT: 3001 + } + }, + { + name: 'aeroecho-frontend', + cwd: './frontend', + script: 'npm', + args: 'start', + env: { + NODE_ENV: 'production', + PORT: 3000 + } + } + ] +}; diff --git a/package-lock.json b/package-lock.json index 3bc7a59..5d810dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,10 @@ { - "name": "my-fullstack-app", + "name": "aeroecho-fullstack", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "my-fullstack-app", + "name": "aeroecho-fullstack", "devDependencies": { "concurrently": "^8.2.2" }