fixing deployment actions
This commit is contained in:
@@ -14,7 +14,7 @@ If you don't have one yet:
|
|||||||
# Install and register
|
# Install and register
|
||||||
./gitea-runner register \
|
./gitea-runner register \
|
||||||
--instance https://git.etcprs.app \
|
--instance https://git.etcprs.app \
|
||||||
--token LSD3GDaXRaU9TUxtrlm8M3hOF72KFipIYchUpqda \
|
--token <your-runner-token> \
|
||||||
--name "droplet-runner" \
|
--name "droplet-runner" \
|
||||||
--labels "ubuntu-latest"
|
--labels "ubuntu-latest"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# .gitea/workflows/ci.yml
|
# .gitea/workflows/ci.yml
|
||||||
# Runs on every push and pull request.
|
# Runs on every push and pull request (except main, which uses deploy.yml).
|
||||||
# Checks syntax, imports, and that the build succeeds.
|
# Designed for a host-mode act_runner on Ubuntu with Node 20 already installed.
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- main # main is handled by deploy.yml
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -17,33 +17,25 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Verify Node.js
|
||||||
uses: actions/setup-node@v4
|
run: node --version && npm --version
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
# ── Syntax check all server-side JS files ────────────────────────────
|
|
||||||
- name: JS syntax check
|
- name: JS syntax check
|
||||||
run: |
|
run: |
|
||||||
find src -name "*.js" | xargs -I{} node --check {}
|
find src -name "*.js" | xargs -I{} node --check {}
|
||||||
echo "✓ JS syntax OK"
|
echo "✓ JS syntax OK"
|
||||||
|
|
||||||
# ── Svelte component check ────────────────────────────────────────────
|
|
||||||
- name: Svelte check
|
- name: Svelte check
|
||||||
run: npx svelte-check --tsconfig ./jsconfig.json 2>&1 | tail -5
|
run: npx svelte-check 2>&1 | tail -10
|
||||||
continue-on-error: false
|
|
||||||
|
|
||||||
# ── Full Vite build (catches broken imports + SSR errors) ─────────────
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
env:
|
env:
|
||||||
# Provide dummy env vars so the build doesn't fail on missing config
|
|
||||||
DATABASE_URL: ./dummy.db
|
DATABASE_URL: ./dummy.db
|
||||||
RATE_LIMIT_PUBLISH: '5'
|
RATE_LIMIT_PUBLISH: '5'
|
||||||
RATE_LIMIT_READ: '100'
|
RATE_LIMIT_READ: '100'
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# .gitea/workflows/deploy.yml
|
# .gitea/workflows/deploy.yml
|
||||||
# Triggered on push to main.
|
# Triggered on push to main.
|
||||||
# Runs the full CI suite first, then deploys to the production droplet.
|
# Runs CI checks first, then deploys to production.
|
||||||
#
|
#
|
||||||
# Required Gitea secrets (Settings → Secrets):
|
# Required Gitea secrets (Settings → Secrets → Actions):
|
||||||
# DEPLOY_HOST — droplet IP or hostname (e.g. 192.168.1.1)
|
# DEPLOY_HOST — droplet IP or hostname
|
||||||
# DEPLOY_USER — SSH user (e.g. root)
|
# DEPLOY_USER — SSH user (e.g. root)
|
||||||
# DEPLOY_SSH_KEY — private key contents (the output of: cat ~/.ssh/deploy_key)
|
# DEPLOY_SSH_KEY — private key (contents of ~/.ssh/deploy_key)
|
||||||
# DEPLOY_PORT — SSH port (usually 22)
|
# DEPLOY_PORT — SSH port (usually 22)
|
||||||
|
|
||||||
name: Deploy
|
name: Deploy
|
||||||
@@ -23,13 +23,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Verify Node.js
|
||||||
uses: actions/setup-node@v4
|
run: node --version && npm --version
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -40,7 +37,7 @@ jobs:
|
|||||||
echo "✓ JS syntax OK"
|
echo "✓ JS syntax OK"
|
||||||
|
|
||||||
- name: Svelte check
|
- name: Svelte check
|
||||||
run: npx svelte-check --tsconfig ./jsconfig.json 2>&1 | tail -5
|
run: npx svelte-check 2>&1 | tail -10
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
@@ -54,7 +51,7 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
name: Deploy to Production
|
name: Deploy to Production
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build # only runs if build job passes
|
needs: build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy via SSH
|
- name: Deploy via SSH
|
||||||
@@ -66,24 +63,16 @@ jobs:
|
|||||||
port: ${{ secrets.DEPLOY_PORT }}
|
port: ${{ secrets.DEPLOY_PORT }}
|
||||||
script: |
|
script: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
APP_DIR=/opt/etc-prs/app
|
APP_DIR=/opt/etc-prs/app
|
||||||
APP_USER=prs
|
APP_USER=prs
|
||||||
|
|
||||||
echo "▸ Pulling latest code…"
|
echo "▸ Pulling latest code…"
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR" && git pull
|
||||||
git pull
|
|
||||||
|
|
||||||
echo "▸ Installing dependencies…"
|
echo "▸ Installing dependencies…"
|
||||||
npm install --quiet
|
npm install --quiet
|
||||||
|
|
||||||
echo "▸ Building…"
|
echo "▸ Building…"
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
echo "▸ Fixing ownership…"
|
echo "▸ Fixing ownership…"
|
||||||
chown -R "${APP_USER}:${APP_USER}" "$APP_DIR"
|
chown -R "${APP_USER}:${APP_USER}" "$APP_DIR"
|
||||||
|
|
||||||
echo "▸ Reloading PM2…"
|
echo "▸ Reloading PM2…"
|
||||||
pm2 reload etc-prs
|
pm2 reload etc-prs
|
||||||
|
|
||||||
echo "✓ Deploy complete"
|
echo "✓ Deploy complete"
|
||||||
|
|||||||
Reference in New Issue
Block a user