-
Notifications
You must be signed in to change notification settings - Fork 12
149 lines (129 loc) Β· 5.4 KB
/
main.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build Hugo and Deploy
on:
push:
branches:
- main
# schedule:
# - cron: 0 16 * * *
workflow_dispatch:
repository_dispatch:
types: [build-hugo]
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Build Hugo
run: |
hugo --cleanDestinationDir --forceSyncStatic --gc --ignoreCache --minify --enableGitInfo --templateMetrics --templateMetricsHints
- name: Setup Node LTS
uses: actions/setup-node@v4
with:
node-version: 20.x
# cache: yarn
- name: Install and run Shiki
run: |
export NODE_OPTIONS="--max_old_space_size=7168"
npm install
npm run shiki || true
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# personal_token: ${{ secrets.personal_token }}
# external_repository: eallion/blog
# publish_branch: main
# publish_dir: ./public
# # destination_dir: public
# allow_empty_commit: true
# # commit_message: ${{ GitHub.event.head_commit.message }}
# full_commit_message: ${{ github.event.head_commit.message }}
# #cname: eallion.com
# force_orphan: true
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
# - name: Onionsite Pull Webhook
# uses: eallion/fast-webhook@v1
# with:
# url: ${{ secrets.ONION_WEBHOOK_URL }}
# json: '{"onion": "pull"}'
# - name: Algolia uploader
# uses: wangchucheng/algolia-uploader@master
# with:
# app_id: ${{ secrets.ALGOLIA_APPID }}
# admin_key: ${{ secrets.ALGOLIA_ADMIN_KEY }}
# index_name: eallion
# index_file_path: public/index.json
# - name: Algolia uploader English
# uses: wangchucheng/algolia-uploader@master
# with:
# app_id: ${{ secrets.ALGOLIA_APPID }}
# admin_key: ${{ secrets.ALGOLIA_ADMIN_KEY }}
# index_name: "eallion_blog_en"
# index_file_path: public/en/index.json
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: public
# Optional: Enable this if you want to have GitHub Deployments triggered
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
# branch: main
# Optional: Change the working directory
# workingDirectory: my-site
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
wranglerVersion: '3'
- name: Deploy to Aliyun OSS
uses: fangbinwei/aliyun-oss-website-action@v1
with:
accessKeyId: ${{ secrets.ACCESS_KEY_ID }}
accessKeySecret: ${{ secrets.ACCESS_KEY_SECRET }}
bucket: eallion-com
endpoint: oss-cn-shanghai.aliyuncs.com
folder: public
skipSetting: true
# exclude: |
# tmp.txt
- name: Refresh volcengine CDN
run: |
curl -s "https://api.github.com/repos/volcengine/volcengine-cli/releases/latest" | grep "browser_download_url.*linux_amd64.zip" | cut -d : -f 2,3 | tr -d \" | wget -O ve.zip -qi -
unzip -q ve.zip > /dev/null 2>&1
chmod a+x ./ve
./ve configure set --profile volcengine-hugo-github-actions --region cn-beijing --endpoint cdn.volcengineapi.com --access-key ${{ secrets.VOLC_ACCESS_KEY }} --secret-key ${{ secrets.VOLC_SECRET_KEY }}
./ve cdn SubmitRefreshTask --body '{"Type":"dir","Urls":"https://www.eallion.com/"}' > /dev/null 2>&1 || true
# - name: Upload to Tencent COS CN
# uses: zkqiang/[email protected]
# with:
# args: upload -rsf --delete ./public/ /
# secret_id: ${{ secrets.SECRET_COS_ID }}
# secret_key: ${{ secrets.SECRET_COS_KEY }}
# bucket: ${{ secrets.COS_CN_BUCKET }}
# region: ap-shanghai
# - name: Tencent CDN Purge
# uses: keithnull/[email protected]
# env:
# SECRET_ID: ${{ secrets.SECRET_COS_ID }}
# SECRET_KEY: ${{ secrets.SECRET_COS_KEY }}
# PATHS: "https://eallion.com/,https://www.eallion.com/"
# FLUSH_TYPE: "delete" # optional
# - name: Install TencentCloud CLI
# run: |
# pip install tccli
# - name: Configure Tccli Credentials
# run: |
# tccli configure set secretId ${{ secrets.TENCENTCLOUD_TEO_SECRET_ID }}
# tccli configure set secretKey ${{ secrets.TENCENTCLOUD_TEO_SECRET_KEY }}
# - name: Create Tencent Cloud TEO Purge Task
# run: |
# tccli teo CreatePurgeTask --cli-unfold-argument --ZoneId ${{ secrets.TENCENTCLOUD_TEO_ZONEID }} --Type purge_prefix --Method invalidate --Targets 'https://www.eallion.com/'