Skip to content

Commit f37b445

Browse files
committed
add workflow for rebuilding website content
1 parent 05b9682 commit f37b445

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
3+
name: Update website content
4+
5+
on:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
update-website:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
with:
17+
path: src
18+
fetch-depth: 0
19+
20+
- name: Checkout repo (gh-pages branch)
21+
uses: actions/checkout@v3
22+
with:
23+
ref: gh-pages
24+
path: pages
25+
26+
- name: Update content
27+
run: |
28+
rm -f pages/*.md
29+
cp -v src/docs/website/*.md pages/
30+
31+
echo "* regenerating changelog page..."
32+
(echo $'---\n---\n' && cat src/CHANGELOG.md) > pages/changelog.md
33+
34+
echo "* updating version data files..."
35+
mkdir -p pages/_data
36+
# current version
37+
git -C src describe --tags --abbrev=0 > pages/_data/current_version.yml
38+
# all known versions
39+
git -C src tag -l | sed 's/^/- /' > pages/_data/versions.yml
40+
41+
- name: Commit and push
42+
run: |
43+
commit=$(git -C src rev-parse HEAD)
44+
pushd pages
45+
if [ $(git status --porcelain | wc -l) -eq 0 ]; then
46+
echo "* content did not change, not updating gh-pages branch"
47+
exit
48+
fi
49+
echo "* content changed, updating gh-pages branch"
50+
echo "$commit" > _data/commit_info.yml
51+
git config user.name 'Georg Gadinger'
52+
git config user.email 'nilsding@nilsding.org'
53+
git add .
54+
git commit -m "update content from ${commit}"
55+
git push
56+
popd

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ compile_commands.json
8181

8282
# RDoc output
8383
/doc
84+
# Our docs
85+
!/docs
8486

8587
# MRuby version lockfile
8688
mruby_config.rb.lock

0 commit comments

Comments
 (0)