-
-
Notifications
You must be signed in to change notification settings - Fork 126
46 lines (37 loc) · 1.33 KB
/
aliyun_cdn.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# workflow 名称,执行时的标题
name: Publish to Aliyun
# 触发条件
on:
release:
types: [published]
# 不清楚干嘛的,保留着
workflow_dispatch:
# 真正的任务
jobs:
# job 名称
build:
# 运行环境
runs-on: ubuntu-latest
# 步骤
# 1. checkout repo
steps:
- name: Checkout Repository
uses: actions/checkout@v3
# 2. 配置 node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
# 3. OSS 脚本相关配置
- name: Setup Aliyun OSS
uses: manyuanrong/setup-ossutil@master
with:
endpoint: ${{ secrets.ALI_ENDPOINT }}
access-key-id: ${{ secrets.ALI_ACCESSKEYID }}
access-key-secret: ${{ secrets.ALI_ACCESSKEYSECRET }}
# 4. 执行 OSS 脚本,ossutil 用法 `https://help.aliyun.com/document_detail/50452.html`
- name: Upload to Aliyun OSS
# run: ossutil cp -r source/ oss://${{ secrets.ALI_BUCKET }}/projects/hexo-theme-redefine/${{ github.event.release.name }}/source/
run: |
VERSION=$(echo ${{ github.event.release.name }} | sed 's/v//') # Remove the 'v' prefix from the release name
ossutil cp -r source/ oss://${{ secrets.ALI_BUCKET }}/projects/hexo-theme-redefine@$VERSION/source/