Repository navigation
73 lines (65 loc) · 2.25 KB
/
Copy pathmain.yaml
File metadata and controls
73 lines (65 loc) · 2.25 KB
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
# based on https://github.com/peaceiris/actions-hugo
name: update & deploy
on:
push:
branches:
- main
# schedule:
# - cron: "36 5 * * *" # 分 时 日 月 周
jobs:
update:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
submodules: recursive # Fetch Hugo themes recursively
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
lfs: true # download Git-LFS files
- name: Use Python3
uses: actions/setup-python@v6
with:
python-version: "3.13"
architecture: "x64"
- name: Update Posts Trending
run: |
# decrypt service-account.json
gpg --quiet --batch --yes --decrypt --passphrase="$SERVICE_ACCOUNT_DECRYPT_KEY" --output google-service-account.json google-service-account.json.gpg
pip3 install "google-api-python-client==2.36.0" "google-auth==2.4.0" "pyyaml"
# generate website_statistics.json
python3 update_statistics.py
python3 process_posts.py
# commit changes
env:
SERVICE_ACCOUNT_DECRYPT_KEY: ${{ secrets.SERVICE_ACCOUNT_DECRYPT_KEY }}
- name: Commit Changes
run: |
git config --local user.email "ryan4yin[bot]@users.noreply.github.com"
git config --local user.name "ryan4yin[bot]"
git add data/
git commit -m "feat: update data/"
git push
git clean -fxd
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.165.0"
extended: true # need extended version to support SASS/SCSS
- name: Build
run: hugo --minify --printUnusedTemplates --logLevel=debug
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: thiscte.world
- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version: "24.x"
- name: Push Argolia Index
run: |
npm install algoliasearch@4.12.1
node push_argolia_index.js
env:
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}