forked from lwg/issues
-
Notifications
You must be signed in to change notification settings - Fork 28
85 lines (75 loc) · 2.71 KB
/
deploy.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
# A workflow to update the online issues lists.
name: Generate HTML pages
on:
# This job must only be run when changes are pushed to the master branch!
push:
branches: [ master ]
jobs:
update-html-pages:
runs-on: ubuntu-latest
steps:
- name: Use cached git repo
# Try to use a cached copy of the repository to avoid cloning it again
# and then regenerating the meta-data/dates file from scratch (slow!)
id: cache-repo
uses: actions/cache@v3
with:
path: |
.git
xml
meta-data
src
key: cached-repo
- if: ${{ steps.cache-repo.outputs.cache-hit == 'true' }}
# Using cached git repo, so sync with the latest changes.
name: Update cached repo
run: |
# Make sure we are in a clean worktree on the right branch.
git reset --hard HEAD
git checkout master
# Fetch changes since the cache was saved.
git fetch
# Update timestamp of this file so only issue files that get
# changed by the next command will be newer than it.
touch meta-data/dates
# Do a hard reset instead of merge, just in case there has been
# a force push since the cache was last updated.
git reset --hard @{u}
- if: ${{ steps.cache-repo.outputs.cache-hit != 'true' }}
# Not using cached git repo, so clone it (with full history).
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update issue timestamps
run: make dates
- name: Generate HTML lists
run: make lists
# We need a fresh repo that has valid credentials to push to gh-pages.
- name: Clone repo again in order to push
uses: actions/checkout@v3
with:
ref: 'gh-pages'
path: 'gh-pages'
clean: 'false'
- name: Update online pages
run: |
: Push new HTML files to gh-pages branch
mv mailing/*.html gh-pages/
rmdir mailing
cd gh-pages
git config user.name "github-actions"
git config user.email "[email protected]"
# Stage any changes to the individual issues (including new files):
git add issue*.html
# This only compares the staged changes, so ignores new timestamps
# in the lwg-*.html files. The commit -a will pick those up though.
printf '\nChecking HTML issues for changes ...\n'
if git diff --cached --exit-code ; then
echo 'No changes, not publishing new lists.'
else
printf '\nCommitting the changes above:\n'
git commit -a -m 'Automatic update from GitHub Actions workflow'
printf '\nPushing to the gh-pages branch:\n'
git push
fi
cd ..