Skip to content

Commit b4f557c

Browse files
committed
Merge branch 'develop' of github.com:opentiny/tiny-robot into v0.4.0-bubble-part2
2 parents 4fb32c3 + 22b316c commit b4f557c

File tree

133 files changed

+11859
-4913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+11859
-4913
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Deploy Playground to CDN
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
is_latest_release:
7+
description: '当前分支是否是最新release版本'
8+
required: true
9+
default: true
10+
type: boolean
11+
12+
env:
13+
HUAWEI_CLOUD_AK: ${{ secrets.HUAWEI_CLOUD_AK }}
14+
HUAWEI_CLOUD_SK: ${{ secrets.HUAWEI_CLOUD_SK }}
15+
HUAWEI_CLOUD_ENDPOINT: ${{ secrets.HUAWEI_CLOUD_ENDPOINT }}
16+
HUAWEI_CLOUD_BUCKET: ${{ secrets.HUAWEI_CLOUD_BUCKET }}
17+
18+
jobs:
19+
check-secrets:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
secrets-ready: ${{ steps.check.outputs.secrets-ready }}
23+
steps:
24+
- name: Check required secrets
25+
id: check
26+
run: |
27+
if [[ -z "${{ secrets.HUAWEI_CLOUD_AK }}" ]] || \
28+
[[ -z "${{ secrets.HUAWEI_CLOUD_SK }}" ]] || \
29+
[[ -z "${{ secrets.HUAWEI_CLOUD_ENDPOINT }}" ]] || \
30+
[[ -z "${{ secrets.HUAWEI_CLOUD_BUCKET }}" ]]; then
31+
echo "secrets-ready=false" >> $GITHUB_OUTPUT
32+
echo "::error::Required Huawei Cloud secrets are not configured."
33+
echo "::error::Please set: HUAWEI_CLOUD_AK, HUAWEI_CLOUD_SK, HUAWEI_CLOUD_ENDPOINT, HUAWEI_CLOUD_BUCKET"
34+
exit 1
35+
fi
36+
echo "secrets-ready=true" >> $GITHUB_OUTPUT
37+
echo "✅ All required secrets are configured"
38+
39+
build:
40+
# 指定运行环境为最新版本的ubuntu
41+
runs-on: ubuntu-latest
42+
outputs:
43+
version-timestamp: ${{ steps.prepare-version.outputs.version_timestamp }}
44+
cdn-base: ${{ steps.prepare-version.outputs.cdn_base }}
45+
cdn-base-latest: ${{ steps.prepare-version.outputs.cdn_base_latest }}
46+
obs-path: ${{ steps.prepare-version.outputs.obs_path }}
47+
obs-path-latest: ${{ steps.prepare-version.outputs.obs_path_latest }}
48+
steps:
49+
# 步骤1: 检出代码
50+
- name: CheckOut Code
51+
uses: actions/checkout@v4
52+
with:
53+
ref: ${{ github.ref_name }}
54+
55+
# 步骤2: 设置pnpm包管理器
56+
- name: Setup pnpm
57+
uses: pnpm/action-setup@v4
58+
59+
# 步骤3: 设置Node.js环境
60+
- name: Setup Node
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 20 # 使用Node.js 20版本
64+
registry-url: 'https://registry.npmjs.org' # 设置npm registry地址
65+
66+
# 步骤4: 获取pnpm缓存目录路径
67+
- name: Get pnpm store directory
68+
id: pnpm-cache
69+
run: |
70+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
71+
72+
# 步骤5: 配置pnpm缓存
73+
- uses: actions/cache@v3
74+
name: Setup pnpm cache
75+
with:
76+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
77+
# 使用操作系统类型和pnpm-lock.yaml的哈希值作为缓存键
78+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
79+
restore-keys: |
80+
${{ runner.os }}-pnpm-store-
81+
82+
# 步骤6: 安装项目依赖
83+
- name: Install dependencies
84+
run: pnpm i --no-frozen-lockfile
85+
86+
- id: prepare-version
87+
name: Prepare version-timestamp
88+
run: |
89+
# Extract version from package.json
90+
VERSION=$(node -p "require('./packages/playground/package.json').version")
91+
92+
# Generate timestamp in YYYYMMDD-HHMMSS format
93+
TIMESTAMP=$(TZ="Asia/Shanghai" date +%Y%m%d-%H%M%S)
94+
95+
# Combine for version-timestamp
96+
VERSION_TIMESTAMP="${VERSION}-${TIMESTAMP}"
97+
98+
# Set CDN base path
99+
CDN_BASE="https://res-static.opentiny.design/tiny-robot-playground/${VERSION_TIMESTAMP}/"
100+
CDN_BASE_LATEST="https://res-static.opentiny.design/tiny-robot-playground/latest/"
101+
OBS_PATH="tiny-robot-playground/${VERSION_TIMESTAMP}"
102+
OBS_PATH_LATEST="tiny-robot-playground/latest"
103+
104+
# Export as environment variables for subsequent steps
105+
echo "VERSION_TIMESTAMP=$VERSION_TIMESTAMP" >> $GITHUB_ENV
106+
echo "CDN_BASE=$CDN_BASE" >> $GITHUB_ENV
107+
echo "OBS_PATH=$OBS_PATH" >> $GITHUB_ENV
108+
109+
# Set outputs for job-level export
110+
echo "version_timestamp=$VERSION_TIMESTAMP" >> $GITHUB_OUTPUT
111+
echo "cdn_base=$CDN_BASE" >> $GITHUB_OUTPUT
112+
echo "cdn_base_latest=$CDN_BASE_LATEST" >> $GITHUB_OUTPUT
113+
echo "obs_path=$OBS_PATH" >> $GITHUB_OUTPUT
114+
echo "obs_path_latest=$OBS_PATH_LATEST" >> $GITHUB_OUTPUT
115+
116+
echo "Version-Timestamp: $VERSION_TIMESTAMP"
117+
echo "CDN Base: $CDN_BASE"
118+
echo "OBS Path: $OBS_PATH"
119+
120+
# 构建Playground
121+
- name: Build Playground
122+
run: pnpm build:playground
123+
env:
124+
PLAYGROUND_BASE: ${{ env.CDN_BASE }}
125+
126+
- name: Verify build output
127+
run: ls -la ./packages/playground/dist
128+
129+
- name: Upload build artifacts
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: playground-dist
133+
path: ./packages/playground/dist/
134+
retention-days: 1
135+
136+
deploy-cdn:
137+
runs-on: ubuntu-latest
138+
needs: [check-secrets, build]
139+
steps:
140+
- name: Checkout
141+
uses: actions/checkout@v4
142+
143+
- name: Download build artifacts
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: playground-dist
147+
path: ./packages/playground/dist/
148+
149+
- name: Install obsutil
150+
run: |
151+
curl -o obsutil.tar.gz https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz
152+
tar -xzf obsutil.tar.gz
153+
chmod +x obsutil_linux_amd64_*/obsutil
154+
sudo mv obsutil_linux_amd64_*/obsutil /usr/local/bin/obsutil
155+
156+
- name: Configure and Upload to OBS
157+
run: |
158+
obsutil config -i=${{ env.HUAWEI_CLOUD_AK }} \
159+
-k=${{ env.HUAWEI_CLOUD_SK }} \
160+
-e=${{ env.HUAWEI_CLOUD_ENDPOINT }}
161+
# Upload to versioned path
162+
obsutil cp ./packages/playground/dist \
163+
obs://${{ env.HUAWEI_CLOUD_BUCKET }}/${{ needs.build.outputs.obs-path }} \
164+
-r -f -flat
165+
166+
# If is_latest_release is true, also upload to latest path
167+
if [ "${{ github.event.inputs.is_latest_release }}" = "true" ]; then
168+
# use cdn-base-latest replace cdn-base in all ./packages/playground/dist files
169+
find ./packages/playground/dist -type f \( -name "*.html" -o -name "*.js" -o -name "*.mjs" -o -name "*.css" \) \
170+
-exec sed -i "s|${{ needs.build.outputs.cdn-base }}|${{ needs.build.outputs.cdn-base-latest }}|g" {} +
171+
obsutil cp ./packages/playground/dist \
172+
obs://${{ env.HUAWEI_CLOUD_BUCKET }}/${{ needs.build.outputs.obs-path-latest }} \
173+
-r -f -flat
174+
fi
175+
176+
echo "Uploaded to: obs://${{ env.HUAWEI_CLOUD_BUCKET }}/${{ needs.build.outputs.obs-path }}"
177+
echo "CDN URL: https://res-static.opentiny.design/${{ needs.build.outputs.obs-path }}"

docs/demos/sender/All.vue

Lines changed: 0 additions & 155 deletions
This file was deleted.

docs/demos/sender/AutoSize.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/demos/sender/Clearable.vue

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)