Go to file
sky-take out ef29b029a2
CI Pipeline / Lint & Type Check (push) Waiting to run Details
CI Pipeline / Test Suite (push) Blocked by required conditions Details
Deploy to Staging / Build and Push Docker Image (push) Has been cancelled Details
Deploy to Staging / Deploy to Staging Environment (push) Has been cancelled Details
merge: integrate remote CI repo README with local project
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-08 19:45:57 +08:00
.GitLink/workflows feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
.github/workflows feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
src feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
tests 添加 CI/CD 流水线配置 2026-05-08 14:40:22 +08:00
.eslintrc.json 添加 CI/CD 流水线配置 2026-05-08 14:40:22 +08:00
.gitignore 添加 CI/CD 流水线配置 2026-05-08 14:40:22 +08:00
Dockerfile feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
README.md merge: integrate remote CI repo README with local project 2026-05-08 19:45:57 +08:00
package-lock.json feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
package.json feat: CI/CD workflows, Dockerfile, lockfile, master branch triggers 2026-05-08 19:43:02 +08:00
test-setup.js 添加 CI/CD 流水线配置 2026-05-08 14:40:22 +08:00
tsconfig.json 添加 CI/CD 流水线配置 2026-05-08 14:40:22 +08:00

README.md

GitLink CI/CD Demo Projectdanshen/CI

一个用于演示 GitLink / GitHub Actions 风格 CI/CD 的示例项目。

项目结构

.
├── .github/workflows/       # 标准 Actions 目录(多数平台识别这里)
│   ├── ci.yml
│   ├── deploy-staging.yml
│   └── deploy-prod.yml
├── .GitLink/workflows/      # 与上面内容相同;若 GitLink 只认此目录,保留其一即可
│   ├── ci.yml
│   ├── deploy-staging.yml
│   └── deploy-prod.yml
├── Dockerfile
├── src/
├── tests/
├── package.json
├── package-lock.json        # 提交到 GitCI 里 npm ci 需要
└── README.md

功能特性

  • greet(name): 生成问候语
  • add(a, b): 加法运算
  • isValidEmail(email): 邮箱验证

流水线做什么

工作流 何时运行
CI Pipeline 推送到 main / master / develop,或针对这些分支的 PR也可手动运行
Deploy to Staging 推送到 mainmaster 且改动了应用相关路径;也可手动运行
Deploy to Production 仅手动运行,且输入框必须填 deploy

针对仓库 https://gitlink.org.cn/danshen/CI.git 的操作示例

你的 GitLink 项目页:danshen/CI(默认分支一般是 master)。流水线入口在顶部 「流水线(devops)」

1. 在本机绑定远程并推送PowerShell

在项目根目录执行(若已添加过 origin,先 git remote remove origin

cd d:\Litter\111
git remote add origin https://gitlink.org.cn/danshen/CI.git
git checkout -B master
git add -A
git status
git commit -m "chore: add CI/CD workflows and demo app"

若远程已有一次提交(例如只有 README.md),第一次推送前需要合并历史:

git pull origin master --allow-unrelated-histories
# 若有冲突按提示解决后git add -A && git commit -m "merge remote"
git push -u origin master

若你确认可以覆盖远程、只保留本地这一套代码:

git push -u origin master --force

2. 在网页上点哪里

  1. 浏览器打开:https://gitlink.org.cn/danshen/CI
  2. 「流水线(devops)」,应能看到 CI PipelineDeploy to StagingDeploy to Production
  3. 若列表为空:到 「代码库」 确认已推送 .github/workflows/.GitLink/workflows/ 下的 ymlGitLink 帮助中心里会说明认哪个目录(常见为与 GitHub 类似的 workflows 目录)。

3. 分支说明

本仓库流水线已对 mastermaindevelop 配置触发;与你当前 GitLink 默认 master 一致,推送到 master 即可跑 CI合并到 master 也会触发预发布镜像流水线(在改动命中 paths 时)。


  1. 把本仓库推送到 GitLink(见上文命令)。
  2. 打开 「流水线(devops)」,确认能看到上述三个工作流。
  3. 若同一次推送触发了两套完全相同的流水线(因为同时存在 .github.GitLink 两套 yml删掉你平台不读取的那一套目录里的 yml 即可,只保留一个目录。
  4. Settings → Environments(或 GitLink 等价菜单)里新建 stagingproduction;生产环境建议开启 审批人
  5. (可选)在 Secrets 里添加 CODECOV_TOKEN、在 production 环境配置 PROD_API_KEY
  6. 若推镜像到 ghcr.io 失败:在平台文档中开启 Packages 写入权限或按说明改用个人访问令牌PAT登录镜像仓库。

开发命令

npm ci
npm run lint
npm run type-check
npm test
npm run build

许可证

MIT License