-
Notifications
You must be signed in to change notification settings - Fork 17
61 lines (50 loc) · 2.17 KB
/
Copy pathmain.yml
File metadata and controls
61 lines (50 loc) · 2.17 KB
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
name: Update pages
on:
push:
branches:
- source # Only build the "source" branch ("master" = built, published pages, this can't be changed for organization GitHub Pages)
jobs:
update-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Publish pages to web
shell: bash
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
# Install dependency
pip install docutils
# Add git metadata
git config user.name "Automated build"
git config user.email "nobody@example.com"
# Build the pages
make clean
make
git add --all .
# index.html is the old, rather simple site, built from the rst files, let's keep it
# at index_old.html for a while.
git mv index.html index_old.html
# index3.html is the new site made with threejs - let's use the new site!
git mv index3.html index.html
git commit -m "Automatically built pages at $(git rev-parse --short HEAD)" || exit 0
# travis/github_deploy_key.enc is an encrypted SSH key.
# The keys for this key are stored with GitHub and are exposed in the
# $encrypted... environment variables. (These are *not* available in pull request builds!)
# The public key is set up as a deployment key in the GitHub repository.
# The following document explains the process:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
gpg --quiet --batch --yes --decrypt --passphrase="$GPG_PASSPHRASE" --output github_deploy_key .github/keys/github_deploy_key.asc
# Add the SSH key
chmod 600 github_deploy_key
eval `ssh-agent -s`
ssh-add github_deploy_key
# Push changes to the *master* branch
# Remember, this is building the *source* branch.
git push --force git@github.com:borgbackup/borgbackup.github.io.git HEAD:master
# Kill SSH agent, get rid of the key (GitHub does that as well)
kill $SSH_AGENT_PID
shred -u github_deploy_key