|
1 | 1 | name: Build |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: [ push ] |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: build-${{ github.ref }} |
| 7 | + cancel-in-progress: false |
4 | 8 |
|
5 | 9 | jobs: |
6 | 10 | build: |
7 | 11 |
|
8 | 12 | runs-on: ubuntu-latest |
9 | 13 |
|
10 | 14 | 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" |
| 15 | + - name: Download Source file |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: source |
| 19 | + fetch-depth: 0 |
20 | 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 |
| 21 | + - name: Prepare Node env |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: "20.x" |
29 | 25 |
|
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 |
| 26 | + - name: Set env |
| 27 | + env: |
| 28 | + ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }} |
| 29 | + run: | |
| 30 | + mkdir -p ~/.ssh/ |
| 31 | + echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa |
| 32 | + chmod 600 ~/.ssh/id_rsa |
| 33 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
42 | 34 |
|
43 | | - - name: Turnstyle |
44 | | - uses: softprops/turnstyle@v1 |
45 | | - env: |
46 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: Vuepress |
| 36 | + run: | |
| 37 | + yarn |
| 38 | + yarn run docs:build |
| 39 | + cp README.md docs/.vuepress/dist |
| 40 | + cd docs/.vuepress/dist |
| 41 | + git config --global user.name 'Fluid-dev' |
| 42 | + git config --global user.email 'a.fake.account@github.com' |
| 43 | + git init |
| 44 | + git add -A |
| 45 | + git commit -m 'Update' |
| 46 | + git push -f git@github.com:fluid-dev/hexo-fluid-docs.git master |
47 | 47 |
|
48 | | - - name: Setup qshell |
49 | | - uses: foxundermoon/setup-qshell@v5 |
50 | | - with: |
51 | | - version: '2.12.0' |
| 48 | + - name: Setup qshell |
| 49 | + uses: foxundermoon/setup-qshell@v5 |
| 50 | + with: |
| 51 | + version: '2.12.0' |
52 | 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 |
| 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 |
0 commit comments