next-windfonts/.forgejo/workflows/ci.yml
bo.yu 1c1c82ae07
Some checks are pending
CI / 代码检查和类型检查 (push) Waiting to run
CI / 构建应用 (push) Blocked by required conditions
CI / 安全扫描 (push) Waiting to run
Deploy / 构建并推送 Docker 镜像 (push) Waiting to run
Deploy / 部署到生产环境 (push) Blocked by required conditions
Deploy / 部署到测试环境 (push) Blocked by required conditions
Deploy / 部署通知 (push) Blocked by required conditions
ci: 添加 Forgejo Actions 工作流配置
添加 CI/CD 工作流配置文件,包括:
- ci.yml: 代码检查、构建和安全扫描
- deploy.yml: 构建 Docker 镜像和部署到不同环境
- database.yml: 数据库迁移、备份和回滚操作
- README.md: 工作流使用说明和配置指南
2025-09-17 17:18:03 +08:00

105 lines
No EOL
2.4 KiB
YAML

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
NODE_VERSION: '20'
jobs:
lint-and-typecheck:
name: 代码检查和类型检查
runs-on: docker
container:
image: node:20-alpine
steps:
- name: 检出代码
uses: https://code.forgejo.org/actions/checkout@v4
with:
fetch-depth: 0
- name: 设置 Node.js 缓存
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.yarn/cache
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: 安装依赖
run: |
yarn config set registry https://registry.npmmirror.com
yarn install --frozen-lockfile
- name: 代码风格检查
run: yarn lint
- name: TypeScript 类型检查
run: yarn typecheck
build:
name: 构建应用
runs-on: docker
container:
image: node:20-alpine
needs: lint-and-typecheck
steps:
- name: 检出代码
uses: https://code.forgejo.org/actions/checkout@v4
with:
fetch-depth: 0
- name: 设置 Node.js 缓存
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.yarn/cache
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: 安装依赖
run: |
yarn config set registry https://registry.npmmirror.com
yarn install --frozen-lockfile
- name: 构建应用
run: yarn build
env:
NODE_ENV: production
- name: 上传构建产物
uses: https://code.forgejo.org/actions/upload-artifact@v4
with:
name: build-files
path: |
.next/
public/
retention-days: 7
security-scan:
name: 安全扫描
runs-on: docker
container:
image: node:20-alpine
steps:
- name: 检出代码
uses: https://code.forgejo.org/actions/checkout@v4
- name: 安装依赖
run: |
yarn config set registry https://registry.npmmirror.com
yarn install --frozen-lockfile
- name: 安全漏洞扫描
run: yarn audit --audit-level moderate
continue-on-error: true