guidly/.gitea/workflows/ci.yml
laruevin 0427e47ba8
All checks were successful
CI/CD / lint (push) Successful in 12s
CI/CD / build (push) Successful in 18s
CI/CD / deploy (push) Successful in 20s
fix: revert checkout action to standard syntax, remove setup-node
Node.js is already installed on the host runner.
actions/checkout@v4 auto-resolves from GitHub.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 15:16:29 +07:00

48 lines
1.3 KiB
YAML

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run lint
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
deploy:
runs-on: ubuntu-latest
needs: build
if: gitea.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- name: Deploy to production
run: |
DEPLOY_DIR=/root/guidly
sudo mkdir -p "$DEPLOY_DIR"/{dist,dist-server,dist-bot,deploy}
sudo rsync -a --delete dist/ "$DEPLOY_DIR/dist/"
sudo rsync -a --delete dist-server/ "$DEPLOY_DIR/dist-server/"
sudo rsync -a --delete dist-bot/ "$DEPLOY_DIR/dist-bot/"
sudo cp -f package.json package-lock.json ecosystem.config.cjs "$DEPLOY_DIR/"
sudo cp -f deploy/nginx-guidly.conf "$DEPLOY_DIR/deploy/" 2>/dev/null || true
cd "$DEPLOY_DIR"
sudo npm install --omit=dev
sudo pm2 delete guidly-server 2>/dev/null || true
sudo pm2 start ecosystem.config.cjs
sudo pm2 save
echo "=== Deploy complete ==="