blob: 761736e75492898f06bc26ff0374cf3cc8a70380 (
plain)
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
|
name: documentation cleanup
on:
schedule:
- cron: '0 1 * * SUN'
jobs:
docs-cleanup:
runs-on: ubuntu-latest
if: github.repository == 'cvc5/cvc5'
steps:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-jinja2
- name: Setup Deploy Key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.CVC5_DOCS_TOKEN }}"
- name: Clone docs repo
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
git config --global user.email "docbot@cvc5"
git config --global user.name "DocBot"
git clone git@github.com:cvc5/docs-ci.git target/
- name: Remove stale docs
run: |
cd target
for file in `find ./ -maxdepth 1 -name "docs-*"`; do
mod=`git log -1 HEAD --pretty="%ci" $file`
touch -d "$mod" $file
done
find ./ -maxdepth 1 -name "docs-*" -mtime +7 -exec git rm -r {} +
find ./ -maxdepth 1 -name "docs-*" -xtype l -exec git rm {} +
git commit -m "Prune docs" || echo "Nothing to prune"
- name: Squash old commits
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
cd target
git log
first=`git rev-list --max-parents=0 HEAD`
last=`git rev-list --until=1.month.ago -n1 HEAD`
if [ -n "$last" ]; then
git checkout $last
git reset --soft $first
git commit -m "Squash old history"
git cherry-pick $last..main
git log
fi
- name: Push
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
cd target
python3 genindex.py
git add README.md
if git diff --cached --exit-code
then
echo "Nothing changed"
else
git commit -m "Update README.md"
fi
git push -f origin HEAD:main
|