Skip to content

Commit 2a72f4c

Browse files
committed
拆分工作流
1 parent 26eb73b commit 2a72f4c

File tree

4 files changed

+147
-60
lines changed

4 files changed

+147
-60
lines changed

.github/workflows/gh-pages.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish GitHub Pages
2+
3+
# Controls when the action will run.
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
# Allow one concurrent deployment
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: true
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
# This workflow contains a single job called "build"
20+
build_and_deploy:
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
# The type of runner that the job will run on
25+
runs-on: ubuntu-latest
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
- uses: actions/checkout@v4
31+
with:
32+
# if your default branches is not master, please change it here
33+
ref: master
34+
submodules: 'recursive'
35+
36+
- name: Setup Hugo
37+
uses: peaceiris/actions-hugo@v3
38+
with:
39+
hugo-version: 'latest'
40+
extended: true
41+
42+
- name: Build
43+
run: hugo --gc --minify --cleanDestinationDir
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
# Upload dist repository
49+
path: './public'
50+
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.github/workflows/ipfs.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish IPFS
2+
3+
# Controls when the action will run.
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
# Allow one concurrent deployment
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: true
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
# This workflow contains a single job called "build"
20+
build_and_deploy:
21+
runs-on: ubuntu-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v4
27+
with:
28+
# if your default branches is not master, please change it here
29+
ref: master
30+
submodules: 'recursive'
31+
32+
- name: Setup Hugo
33+
uses: peaceiris/actions-hugo@v3
34+
with:
35+
hugo-version: 'latest'
36+
extended: true
37+
38+
- name: Update config.yml
39+
uses: fjogeleit/yaml-update-action@main
40+
with:
41+
valueFile: 'config.yml'
42+
propertyPath: 'params.robotsNoIndex'
43+
value: true
44+
45+
- name: Build
46+
run: hugo --gc --minify --cleanDestinationDir
47+
48+
- name: Generate robots.txt
49+
run: |
50+
echo "User-agent: *" > ./public/robots.txt
51+
echo "Disallow: /" >> ./public/robots.txt
52+
53+
- name: Connect to ssh in BG
54+
timeout-minutes: 2
55+
run: |
56+
echo "${{ secrets.SSHKEY }}" > ../privkey
57+
chmod 600 ../privkey
58+
ssh -o StrictHostKeyChecking=no ${{ secrets.SSHHOST }} -i ../privkey -L 5001:localhost:5001 -fTN
59+
60+
- name: IPFS upload
61+
uses: filebase/ipfs-action@master
62+
id: deploy
63+
timeout-minutes: 2
64+
with:
65+
path: ./public
66+
service: ipfs
67+
verbose: true
68+
host: localhost
69+
port: 5001
70+
protocol: http
71+
key: ipfs-action
72+
73+
- name: IPFS upload to filebase
74+
uses: filebase/ipfs-action@master
75+
with:
76+
path: ./public
77+
service: filebase
78+
pinName: ipfs-action
79+
filebaseBucket: ${{ secrets.FILEBASE_BUCKET }}
80+
filebaseKey: ${{ secrets.FILEBASE_KEY }}
81+
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
82+
key: ipfs-action

.github/workflows/main.yml

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ jobs:
2525
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2626
- name: Checkout repository
2727
uses: actions/checkout@v4
28-
- name: Checkout submodules
29-
run: git submodule update --init --recursive --remote
30-
31-
- name: Setup Hugo
32-
uses: peaceiris/actions-hugo@v3
33-
with:
34-
hugo-version: 'latest'
35-
extended: true
3628

3729
- name: Get twikoo version
3830
id: twikoo
@@ -49,60 +41,18 @@ jobs:
4941
value: ${{ steps.twikoo.outputs.twikoo_version }}
5042
commitChange: true
5143

52-
- name: Compress Image
53-
run: |
54-
wget 'https://github.com/kornelski/cavif-rs/releases/download/v1.5.4/cavif-1.5.4.zip'
55-
unzip cavif-1.5.4.zip
56-
sudo mv ./linux-generic/cavif /bin
57-
# find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec cavif {} \;
58-
59-
- name: Build
60-
run: hugo --gc --minify --cleanDestinationDir
61-
62-
- name: Deploy
63-
uses: peaceiris/actions-gh-pages@v4
64-
with:
65-
github_token: ${{ secrets.TOKEN }}
66-
publish_branch: master
67-
force_orphan: true
68-
publish_dir: ./public
69-
cname: liudon.com
44+
# - name: Compress Image
45+
# run: |
46+
# wget 'https://github.com/kornelski/cavif-rs/releases/download/v1.5.4/cavif-1.5.4.zip'
47+
# unzip cavif-1.5.4.zip
48+
# sudo mv ./linux-generic/cavif /bin
49+
# # find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec cavif {} \;
7050

71-
- name: Generate robots.txt
72-
run: |
73-
echo "User-agent: *" > ./public/robots.txt
74-
echo "Disallow: /" >> ./public/robots.txt
75-
76-
- name: Connect to ssh in BG
77-
timeout-minutes: 2
78-
run: |
79-
echo "${{ secrets.SSHKEY }}" > ../privkey
80-
chmod 600 ../privkey
81-
ssh -o StrictHostKeyChecking=no ${{ secrets.SSHHOST }} -i ../privkey -L 5001:localhost:5001 -fTN
51+
- name: Build and Publish Github Pages
52+
uses: ./.github/workflows/gh-pages.yml
8253

83-
- name: IPFS upload
84-
uses: filebase/ipfs-action@master
85-
id: deploy
86-
timeout-minutes: 2
87-
with:
88-
path: ./public
89-
service: ipfs
90-
verbose: true
91-
host: localhost
92-
port: 5001
93-
protocol: http
94-
key: ipfs-action
95-
96-
- name: IPFS upload to filebase
97-
uses: filebase/ipfs-action@master
98-
with:
99-
path: ./public
100-
service: filebase
101-
pinName: ipfs-action
102-
filebaseBucket: ${{ secrets.FILEBASE_BUCKET }}
103-
filebaseKey: ${{ secrets.FILEBASE_KEY }}
104-
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
105-
key: ipfs-action
54+
- name: Build and Publish IPFS
55+
uses: ./.github/workflows/ipfs.yml
10656

10757
- name: Easyindex
10858
run: |

config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ params:
6868
ShowFullTextinRSS: true
6969
showFullTextinJSONFeed: true
7070

71+
robotsNoIndex: false
72+
7173
ShowToc: true # 显示目录
7274
TocOpen: true # 自动展开目录
7375

0 commit comments

Comments
 (0)