Files
alrahma_web_client/.gitea/workflows/build.yml
T
root c6d2bc007e
Web Client CI/CD / Lint (ESLint + TypeScript) (push) Successful in 40s
Web Client CI/CD / Build (tsc + Vite) (push) Successful in 24s
Web Client CI/CD / Deploy to shared hosting (push) Successful in 33s
fix first production issues
2026-07-10 03:43:47 -04:00

133 lines
4.3 KiB
YAML

# Gitea CI/CD for alrahma_web_client (React + Vite + TypeScript)
#
# Triggers:
# - Push to any branch
# - Pull requests
# - Tags
#
# Stages: lint → build → deploy (manual)
name: Web Client CI/CD
on:
push:
branches: [main, master, develop, 'feature/**', 'fix/**']
tags: ['v*']
pull_request:
branches: [main, master, develop]
env:
CI: true
jobs:
# ──────────────────────────────────────────────
# LINT: ESLint with TypeScript
# ──────────────────────────────────────────────
lint:
name: Lint (ESLint + TypeScript)
runs-on: ubuntu-latest
container:
image: node:22-alpine
steps:
- name: Checkout repository
env:
GIT_SSL_NO_VERIFY: "1"
run: |
apk add --no-cache git
SERVER="${{ github.server_url }}"
REPO="${{ github.repository }}"
TOKEN="${{ github.token }}"
git clone --depth 1 \
"https://x-access-token:${TOKEN}@${SERVER#https://}/${REPO}.git" \
.
git fetch --depth 1 origin "${{ github.sha }}"
git checkout "${{ github.sha }}"
shell: sh
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Run ESLint
run: npm run lint
# ──────────────────────────────────────────────
# BUILD: TypeScript + Vite
# ──────────────────────────────────────────────
build:
name: Build (tsc + Vite)
runs-on: ubuntu-latest
container:
image: node:22-alpine
steps:
- name: Checkout repository
env:
GIT_SSL_NO_VERIFY: "1"
run: |
apk add --no-cache git
SERVER="${{ github.server_url }}"
REPO="${{ github.repository }}"
TOKEN="${{ github.token }}"
git clone --depth 1 \
"https://x-access-token:${TOKEN}@${SERVER#https://}/${REPO}.git" \
.
git fetch --depth 1 origin "${{ github.sha }}"
git checkout "${{ github.sha }}"
shell: sh
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Build project
run: npm run build
env:
VITE_API_URL: ${{ vars.VITE_API_URL || '' }}
# ──────────────────────────────────────────────
# DEPLOY (manual): to shared hosting via SSH
# ──────────────────────────────────────────────
deploy:
name: Deploy to shared hosting
runs-on: ubuntu-latest
container:
image: node:22-alpine
if: github.ref == 'refs/heads/develop'
needs: [lint, build]
environment:
name: production
url: ${{ vars.PRODUCTION_URL }}
steps:
- name: Checkout repository
env:
GIT_SSL_NO_VERIFY: "1"
run: |
apk add --no-cache git
SERVER="${{ github.server_url }}"
REPO="${{ github.repository }}"
TOKEN="${{ github.token }}"
git clone --depth 1 \
"https://x-access-token:${TOKEN}@${SERVER#https://}/${REPO}.git" \
.
git fetch --depth 1 origin "${{ github.sha }}"
git checkout "${{ github.sha }}"
shell: sh
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Build project
run: npm run build
env:
VITE_API_URL: ${{ vars.VITE_API_URL || '' }}
- name: Install SSH and rsync
run: |
apk add --no-cache openssh-client sshpass rsync
- name: Deploy built files to shared hosting
run: |
sshpass -p "${{ secrets.SSH_PASSWORD }}" rsync -avz --delete \
-e "ssh -p ${{ vars.SSH_PORT || 22 }} -o StrictHostKeyChecking=no" \
--exclude='.htaccess' \
./dist/ \
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ vars.SSH_TARGET_DIR }}/