上传至阿里云OSS
This commit is contained in:
56
.github/workflows/deployOSS.yml
vendored
Normal file
56
.github/workflows/deployOSS.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: Deploy VitePress to AliYun OSS
|
||||||
|
|
||||||
|
on:
|
||||||
|
# 每次推送到main分支时触发部署
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
# 允许手动触发工作流
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# 设置GITHUB_TOKEN的权限
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# 构建工作
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
lfs: true
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build with VitePress
|
||||||
|
run: npm run docs:build
|
||||||
|
|
||||||
|
# docs/.vitepress/dist
|
||||||
|
|
||||||
|
- name: Install OSSUtil
|
||||||
|
run: |
|
||||||
|
curl -o /tmp/ossutil64 https://gosspublic.alicdn.com/ossutil/1.7.8/ossutil64
|
||||||
|
chmod +x /tmp/ossutil64
|
||||||
|
sudo mv /tmp/ossutil64 /usr/local/bin/ossutil
|
||||||
|
|
||||||
|
- name: Upload to Aliyun OSS
|
||||||
|
env:
|
||||||
|
OSS_ACCESS_KEY_ID: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
|
||||||
|
OSS_ACCESS_KEY_SECRET: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
|
||||||
|
OSS_BUCKET: ec-mcwiki
|
||||||
|
OSS_REGION: oss-cn-hangzhou
|
||||||
|
run: |
|
||||||
|
ossutil config -e ${OSS_REGION}.aliyuncs.com -i ${OSS_ACCESS_KEY_ID} -k ${OSS_ACCESS_KEY_SECRET}
|
||||||
|
ossutil cp -r ./docs/.vitepress/dist oss://${OSS_BUCKET}/ --force
|
||||||
Reference in New Issue
Block a user