Skip to content

Commit bc23eb8

Browse files
committed
automatic generation of the static files
1 parent 0de001f commit bc23eb8

File tree

131 files changed

+103
-9076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+103
-9076
lines changed

.github/workflows/deploy.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: deploy-static-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- source
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source Branch
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
submodules: true
18+
19+
- name: Install Hugo
20+
uses: peaceiris/actions-hugo@v2
21+
with:
22+
hugo-version: 'latest'
23+
24+
- name: Build Hugo Site
25+
run: |
26+
hugo --minify
27+
if [ ! -d "public" ] || [ -z "$(ls -A public)" ]; then
28+
echo "Error: Hugo did not generate any files."
29+
exit 1
30+
fi
31+
32+
- name: Get Commit Message
33+
id: commit_message
34+
run: |
35+
# Extract the commit message from the event payload
36+
COMMIT_MSG=$(jq -r '.commits[-1].message' "$GITHUB_EVENT_PATH")
37+
echo "commit_message=${COMMIT_MSG}" >> $GITHUB_ENV
38+
39+
- name: Backup Generated Files and Copy Other Relevant Files
40+
run: |
41+
mkdir -p $HOME/temp
42+
cp -r public/* $HOME/temp/
43+
cp README.md $HOME/temp/
44+
cp lychee.toml $HOME/temp/
45+
46+
- name: List Files
47+
run: |
48+
echo "Listing files in backup directory:"
49+
ls -l $HOME/temp/
50+
51+
- name: Deploy to main Branch
52+
env:
53+
ACTIONS_DEPLOY_TOKEN: ${{ secrets.ACTIONS_DEPLOY_TOKEN }}
54+
COMMIT_MESSAGE: ${{ env.commit_message }}
55+
run: |
56+
# Switch to main branch
57+
git checkout --orphan main
58+
59+
# Clean up and reset branch
60+
git reset --hard
61+
git clean -df
62+
63+
# Restore files from backup
64+
rsync -av $HOME/temp/* . --exclude=$HOME/temp/.git
65+
rm -rf $HOME/temp
66+
67+
# Configure Git
68+
git config --global user.name "github-actions[bot]"
69+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
70+
71+
# Commit and push changes
72+
git add .
73+
git commit -m "Deploying: $COMMIT_MESSAGE"
74+
git push --force origin main
75+
76+
- name: Trigger the linkcheck Workflow
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: |
80+
curl -X POST \
81+
-H "Authorization: Bearer $GITHUB_TOKEN" \
82+
-H "Accept: application/vnd.github+json" \
83+
https://api.github.com/repos/${{ github.repository }}/actions/workflows/linkcheck.yml/dispatches \
84+
-d '{"ref":"source"}'

.github/workflows/linkcheck.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: linkcheck
22

33
on:
4-
push:
54
workflow_dispatch:
65
schedule:
76
- cron: '30 1 * * *' # daily at 01:30 UTC
@@ -13,6 +12,8 @@ jobs:
1312
steps:
1413
- name: Cloning repository
1514
uses: actions/checkout@v4
15+
with:
16+
ref: main
1617

1718
- name: Lychee Link Checker
1819
uses: lycheeverse/lychee-action@v1

2013/index.html

Lines changed: 0 additions & 368 deletions
This file was deleted.

2014/index.html

Lines changed: 0 additions & 418 deletions
This file was deleted.

2015/index.html

Lines changed: 0 additions & 362 deletions
This file was deleted.

2016/index.html

Lines changed: 0 additions & 359 deletions
This file was deleted.

2017/index.html

Lines changed: 0 additions & 359 deletions
This file was deleted.

2018/index.html

Lines changed: 0 additions & 352 deletions
This file was deleted.

2019/index.html

Lines changed: 0 additions & 452 deletions
This file was deleted.

2020/index.html

Lines changed: 0 additions & 462 deletions
This file was deleted.

0 commit comments

Comments
 (0)