guidly/.gitea/workflows/ci.yml
laruevin 3f5f1d463e
Some checks failed
CI/CD / build (push) Blocked by required conditions
CI/CD / deploy (push) Blocked by required conditions
CI/CD / lint (push) Has been cancelled
chore: migrate from GitLab CI to Gitea Actions
Replace .gitlab-ci.yml with .gitea/workflows/ci.yml.
Same pipeline: lint → build → deploy (local, runner on prod server).

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

60 lines
1.6 KiB
YAML

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- 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
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- 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 ==="