-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (51 loc) · 1.75 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
name: Deploy MkDocs to website repo
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get the commit message
id: get_commit_message
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B | head -n 1)
echo "COMMIT_MESSAGE=$(echo $COMMIT_MESSAGE | base64)" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install MkDocs
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
- name: Build the MkDocs site
run: mkdocs build
- name: Checkout the target repo
uses: actions/checkout@v2
with:
repository: The-Church-of-Sigma/Website
path: website-repo
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Create target directory if it doesn't exist
run: mkdir -p website-repo/sigmapedia
- name: Copy the built site
run: |
rm -rf website-repo/sigmapedia/*
cp -r site/* website-repo/sigmapedia/
- name: Commit and push changes
run: |
cd website-repo
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
COMMIT_MESSAGE=$(echo ${{ env.COMMIT_MESSAGE }} | base64 --decode || echo "Update Sigmapedia")
git add .
git commit -m "Sigmapedia: $COMMIT_MESSAGE"
git push
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}