forked from zacjones93/maximevaillancourt.com
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (150 loc) · 4.93 KB
/
jekyll.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Build, Deploy, and Add Posts to Spaced Inbox
on:
push:
branches: ["main"]
repository_dispatch:
types: [trigger-jekyll]
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
sudo apt-get install sqlite3
- name: Cache tag data
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.jekyll-cache
key: tag-data-${{ github.sha }}
save-always: true
restore-keys: |
tag-data-
- name: Cache Jekyll _site directory
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/_site
key: jekyll-site-${{ github.sha }}
save-always: true
restore-keys: |
jekyll-site-
- name: Process markdown files for tags
run: python tags.py
- name: Fetch calendar events
run: python events.py
- name: Commit and push changes (pre-build)
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add --all
git commit --allow-empty -m "Commit ${GITHUB_SHA}" || echo "Nothing to commit"
git push origin main || echo "Nothing to push"
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
env:
PAGES_REPO_NWO: marioseixas/marioseixas.github.io
JEKYLL_ENV: production
base_path: ""
run: |
echo "base_path from env is: ${base_path}"
export base_path="${base_path}"
echo "base_path after export is: ${base_path}"
bundle exec jekyll build --trace --config _config.yml --baseurl "${basepath}"
- name: Generate Pagefind Index
run: |
npx -y pagefind --site ${{ github.workspace }}/_site --output-path ${{ github.workspace }}/_site/pagefind
- name: Modify Pagefind UI
run: python modify-pagefind-ui.py
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ github.workspace }}/_site
publish_branch: gh-pages
cname: ib.bsb.br
allow_empty_commit: true
enable_jekyll: false
keep_files: true
add-posts-to-inbox:
runs-on: ubuntu-latest
needs: build-and-deploy
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python dependencies
run: |
pip install matplotlib
- name: Initialize spaced-inbox database
run: |
if [ ! -f data.db ]; then
sqlite3 data.db < schema.sql
fi
- name: Extract post URLs
id: extract-urls
run: |
BASE_URL="ib.bsb.br"
POST_FILES=$(git diff --name-only HEAD^ HEAD -- '_posts/**.md')
POST_URLS=""
for POST in $POST_FILES; do
FILENAME=$(basename "$POST" .md)
SLUG=$(echo "$FILENAME" | sed 's/^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-//')
POST_URL="$BASE_URL/$SLUG/"
POST_URLS="$POST_URLS\n$POST_URL"
done
echo -e "$POST_URLS" > post_urls.txt
- name: Append URLs to inbox file
run: |
if [ -s post_urls.txt ]; then
while read -r URL; do
echo -e "\n$URL\n=====" >> infoBAG.txt
done < post_urls.txt
fi
shell: bash
- name: Print inbox_files.txt contents
run: cat infoBAG.txt
- name: Run spaced inbox script
run: |
python script.py --no-review
shell: /usr/bin/bash -e {0}
env:
TERM: xterm
- name: Run review load visualizer
run: |
python review_load.py data.db
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Stage Changes
run: git add --all
- name: Commit and Push
run: |
git commit -m "Update spaced-inbox with new posts" || echo "No changes to commit"
git pull --rebase
git push --force-with-lease