Skip to content

Commit f156f5e

Browse files
committed
更新 workflow
1 parent 57ce749 commit f156f5e

3 files changed

Lines changed: 66 additions & 67 deletions

File tree

.github/workflows/vuepress.yml

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,60 @@
11
name: Build
22

3-
on: [push]
3+
on: [ push ]
4+
5+
concurrency:
6+
group: build-${{ github.ref }}
7+
cancel-in-progress: false
48

59
jobs:
610
build:
711

812
runs-on: ubuntu-latest
913

1014
steps:
11-
- name: Download Source file
12-
uses: actions/checkout@v2
13-
with:
14-
ref: source
15-
16-
- name: Prepare Node env
17-
uses: actions/setup-node@v1
18-
with:
19-
node-version: "12.x"
20-
21-
- name: Set env
22-
env:
23-
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }}
24-
run: |
25-
mkdir -p ~/.ssh/
26-
echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa
27-
chmod 600 ~/.ssh/id_rsa
28-
ssh-keyscan github.com >> ~/.ssh/known_hosts
29-
30-
- name: Vuepress
31-
run: |
32-
yarn
33-
yarn run docs:build
34-
cp README.md docs/.vuepress/dist
35-
cd docs/.vuepress/dist
36-
git config --global user.name 'Fluid-dev'
37-
git config --global user.email 'a.fake.account@github.com'
38-
git init
39-
git add -A
40-
git commit -m 'Update'
41-
git push -f git@github.com:fluid-dev/hexo-fluid-docs.git master
42-
43-
- name: Turnstyle
44-
uses: softprops/turnstyle@v1
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
48-
- name: Setup qshell
49-
uses: foxundermoon/setup-qshell@v5
50-
with:
51-
version: '2.12.0'
52-
53-
- name: Upload to OSS
54-
env:
55-
QINIU_ACCESSKEY: ${{ secrets.QINIU_ACCESSKEY }}
56-
QINIU_SECRETKEY: ${{ secrets.QINIU_SECRETKEY }}
57-
QINIU_BUCKET: 'fluid-dev'
58-
run: |
59-
rm -rf ./docs/.vuepress/dist/.git
60-
sed -i 's/\/hexo-fluid-docs\//\/docs\//g' `grep 'hexo-fluid-docs' -rl ./docs/.vuepress/dist/*`
61-
qshell account $QINIU_ACCESSKEY $QINIU_SECRETKEY action
62-
qshell listbucket $QINIU_BUCKET -o bucket.txt
63-
awk -F '\t' '/docs\// {print $1}' bucket.txt > to_delete.txt
64-
qshell batchdelete -F'\t' --force $QINIU_BUCKET -i to_delete.txt
65-
qshell qupload2 --src-dir=./docs/.vuepress/dist --bucket=$QINIU_BUCKET --key-prefix=docs/ --overwrite
66-
echo 'https://fluid-dev.com/docs/\nhttps://hexo.fluid-dev.com/docs/' >> cdnrefresh.txt
67-
qshell cdnrefresh --dirs -i cdnrefresh.txt
15+
- name: Download Source file
16+
uses: actions/checkout@v4
17+
with:
18+
ref: source
19+
fetch-depth: 0
20+
21+
- name: Prepare Node env
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "20.x"
25+
26+
- name: Vuepress
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
run: |
30+
yarn
31+
yarn run docs:build
32+
cp README.md docs/.vuepress/dist
33+
cd docs/.vuepress/dist
34+
git config --global user.name 'Fluid-dev'
35+
git config --global user.email 'a.fake.account@github.com'
36+
git init
37+
git add -A
38+
git commit -m 'Update'
39+
git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/fluid-dev/hexo-fluid-docs.git master
40+
41+
- name: Setup qshell
42+
uses: foxundermoon/setup-qshell@v5
43+
with:
44+
version: '2.12.0'
45+
46+
- name: Upload to OSS
47+
env:
48+
QINIU_ACCESSKEY: ${{ secrets.QINIU_ACCESSKEY }}
49+
QINIU_SECRETKEY: ${{ secrets.QINIU_SECRETKEY }}
50+
QINIU_BUCKET: 'fluid-dev'
51+
run: |
52+
rm -rf ./docs/.vuepress/dist/.git
53+
sed -i 's/\/hexo-fluid-docs\//\/docs\//g' `grep 'hexo-fluid-docs' -rl ./docs/.vuepress/dist/*`
54+
qshell account $QINIU_ACCESSKEY $QINIU_SECRETKEY action
55+
qshell listbucket $QINIU_BUCKET -o bucket.txt
56+
awk -F '\t' '/docs\// {print $1}' bucket.txt > to_delete.txt
57+
qshell batchdelete -F'\t' --force $QINIU_BUCKET -i to_delete.txt
58+
qshell qupload2 --src-dir=./docs/.vuepress/dist --bucket=$QINIU_BUCKET --key-prefix=docs/ --overwrite
59+
echo 'https://fluid-dev.com/docs/\nhttps://hexo.fluid-dev.com/docs/' >> cdnrefresh.txt
60+
qshell cdnrefresh --dirs -i cdnrefresh.txt

docs/.vuepress/enhanceApp.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import Ads from 'vue-google-adsense'
21
import config from './config'
32

43
export default ({ Vue }) => {
5-
Vue.use(require('vue-script2'))
6-
Vue.use(Ads.Adsense)
7-
Vue.use(Ads.InArticleAdsense)
8-
Vue.use(Ads.InFeedAdsense)
9-
Vue.use(Ads.AutoAdsense, { adClient: config.themeConfig.ads.client, isNewAdsCode: true })
4+
if (typeof document !== 'undefined') {
5+
const Ads = require('vue-google-adsense')
6+
Vue.use(require('vue-script2'))
7+
Vue.use(Ads.Adsense)
8+
Vue.use(Ads.InArticleAdsense)
9+
Vue.use(Ads.InFeedAdsense)
10+
Vue.use(Ads.AutoAdsense, { adClient: config.themeConfig.ads.client, isNewAdsCode: true })
11+
}
1012
}

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
"docs:build": "vuepress build docs"
1414
},
1515
"devDependencies": {
16-
"moment": "2.29.1",
17-
"moment-timezone": "0.5.31",
16+
"moment": "2.29.4",
17+
"moment-timezone": "0.5.35",
1818
"vue-google-adsense": "1.10.1",
1919
"vue-script2": "2.1.0",
20-
"vuepress": "1.7.1",
20+
"vuepress": "1.9.10",
2121
"vuepress-plugin-baidu-autopush": "1.0.1",
2222
"vuepress-plugin-clean-urls": "1.1.2",
2323
"vuepress-plugin-seo": "0.1.4",
2424
"vuepress-plugin-sitemap": "2.3.1",
2525
"vuepress-plugin-smooth-scroll": "0.0.10"
26+
},
27+
"resolutions": {
28+
"vue": "2.7.16",
29+
"vue-server-renderer": "2.7.16"
2630
}
2731
}

0 commit comments

Comments
 (0)