Files
xgj/setup-opencode/examples/china-mirror.yml
T
Lyda 489cc94316 feat: 新增 setup-opencode action,支持 npm 全局安装和智能缓存
- 使用 npm 全局安装 OpenCode,支持版本管理和自动更新
- 智能缓存策略:缓存 npm 目录和全局安装,加速后续构建
- 支持淘宝镜像源和自定义 npm 镜像,国内环境友好
- 版本检测:自动比对已安装版本,避免重复安装
- 输出安装版本、缓存命中状态和更新状态
- 提供详细的使用文档和多场景示例
2026-03-17 16:17:03 +08:00

34 lines
831 B
YAML

name: China Mirror Example
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装 OpenCode(淘宝镜像)
id: setup
uses: ./.gitea/actions/setup-opencode
with:
version: 'latest'
use-taobao-registry: 'true'
- name: 显示安装信息
run: |
echo "安装版本: ${{ steps.setup.outputs.version }}"
echo "缓存命中: ${{ steps.setup.outputs.cache-hit }}"
if [[ "${{ steps.setup.outputs.cache-hit }}" == "true" ]]; then
echo "✅ 使用缓存,快速完成安装"
else
echo "📥 通过 npm 安装完成"
fi
- name: 构建项目
run: |
opencode build --release