|
|
@@ -1,72 +0,0 @@
|
|
|
-# 当分支 main 有 push 事件,并且此次 push 包含了 demo 目录下的文件时触发,使用 GitHub Actions 自动构建 Demo 并部署到服务器(使用 ubuntu-latest),具体步骤如下:
|
|
|
-# 1. 安装 nodejs , python3 , pip
|
|
|
-# 2. pip 依次安装 aliyun-python-sdk-cdn , aliyun-python-sdk-core , logging
|
|
|
-# 3. cd demo 安装依赖 npm install
|
|
|
-# 4. 打包 npm run build
|
|
|
-# 5. 使用 appleboy/scp-action@master 将 demo/dist 目录下所有文件上传到服务器上 demo 目录下
|
|
|
-# 6. 执行 demo/scripts/Refresh-auto.py 刷新 CDN 缓存
|
|
|
-
|
|
|
-name: BUILD DEMO
|
|
|
-
|
|
|
-on:
|
|
|
- push:
|
|
|
- branches:
|
|
|
- - main
|
|
|
- paths:
|
|
|
- - 'demo/**'
|
|
|
-
|
|
|
-jobs:
|
|
|
- build:
|
|
|
- runs-on: ubuntu-latest
|
|
|
- steps:
|
|
|
- - name: Checkout
|
|
|
- uses: actions/checkout@v4
|
|
|
- - name: Setup Node.js environment
|
|
|
- uses: actions/setup-node@v3
|
|
|
- with:
|
|
|
- node-version: 20.x
|
|
|
-
|
|
|
- - name: Setup Python environment
|
|
|
- uses: actions/setup-python@v2
|
|
|
- with:
|
|
|
- python-version: 3.x
|
|
|
- - name: Install pip
|
|
|
- run: python3 -m pip install --upgrade pip
|
|
|
- - name: Install aliyun-python-sdk-cdn
|
|
|
- run: python3 -m pip install aliyun-python-sdk-cdn
|
|
|
- - name: Install aliyun-python-sdk-core
|
|
|
- run: python3 -m pip install aliyun-python-sdk-core
|
|
|
- - name: Install logging
|
|
|
- run: python3 -m pip install logging
|
|
|
-
|
|
|
- # cd packages/rollup-plugin-stdf-icon 目录下
|
|
|
- # 安装依赖 npm install
|
|
|
- # 打包 npm run build
|
|
|
- - name: Build rollup-plugin-stdf-icon
|
|
|
- run: |
|
|
|
- cd packages/rollup-plugin-stdf-icon
|
|
|
- npm install
|
|
|
- npm run build
|
|
|
-
|
|
|
- - name: Install dependencies and build
|
|
|
- run: |
|
|
|
- cd demo
|
|
|
- npm install
|
|
|
- npm run build
|
|
|
-
|
|
|
- - name: Upload
|
|
|
- uses: appleboy/scp-action@master
|
|
|
- with:
|
|
|
- host: ${{ secrets.ALIYUN_HOST }}
|
|
|
- username: ${{ secrets.ALIYUN_USERNAME }}
|
|
|
- port: ${{ secrets.ALIYUN_PORT }}
|
|
|
- password: ${{ secrets.ALIYUN_PRIVATE_KEY }}
|
|
|
- source: demo/build/*
|
|
|
- target: /usr/share/nginx/demo_stdf/
|
|
|
- strip_components: 2
|
|
|
-
|
|
|
- - name: Refresh CDN
|
|
|
- env:
|
|
|
- ALIYUN_CDN_AK: ${{ secrets.ALIYUN_CDN_AK }}
|
|
|
- ALIYUN_CDN_SK: ${{ secrets.ALIYUN_CDN_SK }}
|
|
|
- run: python3 demo/scripts/Refresh-auto.py -r demo/scripts/cdn-list.txt -t clear -o Directory
|