Skip to content

fix(GaugeChart): cloud theme display anomaly when custom width is set… #35

fix(GaugeChart): cloud theme display anomaly when custom width is set…

fix(GaugeChart): cloud theme display anomaly when custom width is set… #35

Workflow file for this run

name: Deploy to Huawei OBS
on:
push:
branches: [dev]
workflow_dispatch:
inputs:
version:
description: 输入您将要发布的版本号(默认使用 package.json 中的版本号),例如:`0.1.0`。
required: false
type: string
env:
# 在 GitHub 项目源码仓库 → 项目的 Settings → Secrets(Actions 里的 Repository secrets) 里提前建好以下变量
HUAWEI_CLOUD_AK: ${{ secrets.HUAWEI_CLOUD_AK }}
HUAWEI_CLOUD_SK: ${{ secrets.HUAWEI_CLOUD_SK }}
HUAWEI_CLOUD_ENDPOINT: ${{ secrets.HUAWEI_CLOUD_ENDPOINT }}
HUAWEI_CLOUD_BUCKET: ${{ secrets.HUAWEI_CLOUD_BUCKET }}
permissions:
contents: read
pages: write
id-token: write
jobs:
# Build job
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ver.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install deps
run: npm install --unsafe-perm=true --allow-root --legacy-peer-deps
- name: Get version
id: ver
run: |
# 优先用手动输入的版本号
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="$(node -p "require('./package.json').version")"
fi
echo "version: $VERSION"
echo "value=$VERSION" >> $GITHUB_OUTPUT
- name: Build doc
run: npm run build:opentiny
env:
VITE_OPENTINY_URL_PREFIX: /tiny-charts/
VITE_PUBLISH_URL: //res-static.opentiny.design/tiny-charts-web-doc/${{ steps.ver.outputs.value }}/
- name: Copy files
run: |
cp dist/index.html dist/404.html
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: dist/
# Deploy job
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist/
- name: Show version
run: |
echo "Deploying version: ${{ needs.build.outputs.version }}"
# ===== 下载 obsutil =====
- name: Install obsutil
run: |
curl -o obsutil.tar.gz https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz
tar -xzf obsutil.tar.gz
chmod +x obsutil_linux_amd64_*/obsutil
sudo mv obsutil_linux_amd64_*/obsutil /usr/local/bin/obsutil
# ===== 配置并上传 =====
- name: Upload to OBS
run: |
# 一次性配置 AK/SK/endpoint
obsutil config -i=${{ env.HUAWEI_CLOUD_AK }} \
-k=${{ env.HUAWEI_CLOUD_SK }} \
-e=${{ env.HUAWEI_CLOUD_ENDPOINT }}
# 把本地 dist/ 目录整站同步到桶根目录
echo "needs.build.outputs.version: ${{ needs.build.outputs.version }}"
mv dist ${{ needs.build.outputs.version }}
obsutil cp ${{ needs.build.outputs.version }} obs://${{ env.HUAWEI_CLOUD_BUCKET }}/tiny-charts-web-doc/ -r -f