-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (85 loc) · 2.42 KB
/
blog.yml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Page Builder by ALMO
on:
push:
branches:
- main
paths:
- 'github/workflows/blog.yml'
- 'posts/**.md'
- 'config/**'
- 'assets/**'
- 'blog_builder/**'
- '.rebuild'
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Git
run: |
cd ${{ github.workspace }}
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Setup ALMO
run: |
git submodule update --init --recursive --remote
- name: Compile almo.cpp
run: |
cd ./almo
bash ./scripts/setup.sh
g++ -std=c++23 ./build/almo.cpp -o ./build/almo
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: 'posts/**.md'
json: true
- name: Output changed files
run: echo "${{ steps.changed-files.outputs.all_changed_files }}" > changed_files.json
- name: Check need rebuild
id: check
uses: tj-actions/changed-files@v44
with:
files: |
.github/workflows/blog.yml
config/**
assets/**
blog_builder/**
.rebuild
- name: Output need rebuild
if: ${{ steps.check.outputs.all_changed_files }} != ""
run: echo "REBUILD=true" >> $GITHUB_ENV
- name: Generate HTML
run: |
python3 blog_builder/build.py
- name: Update RSS
run: |
python3 blog_builder/rss.py
- name: Clean up
run: |
rm changed_files.json
rm tmp.json
- name: Check change
run: |
git diff-index --quiet HEAD || echo "CHANGE=true" >> $GITHUB_ENV
- name: Commit changes
run: |
git add .
git commit --allow-empty -m "Update blog"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main