-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (51 loc) · 1.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
name: mkdocs_build_deploy
on:
push:
branches:
- main # Set the branch you want to trigger the workflow on
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8 # Choose the Python version you need
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material pymdown-extensions
- name: Build MkDocs
run: mkdocs build --clean
- name: Create and force push to documentation branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
# Your existing script to force push to the documentation branch
git fetch --all
# Check if there are any local changes
if [ -n "$(git status --porcelain)" ]; then
# If there are changes, commit them
git add .
git commit -m "Committing local changes before switching branches"
else
echo "No local changes to commit."
fi
git checkout production
# Remove files and directories from the production branch
git rm -r --ignore-unmatch */*
git checkout main -- site
# git mv site docs
git add -A
git commit -m "Content update"
git push