-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (57 loc) · 2.22 KB
/
publish.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: Build and Deploy MkDocs
on:
push:
branches:
- docs # Trigger on pushes to the docs branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8' # Use the desired Python version
- name: Install dependencies
run: |
pip install -r requirements.txt # Install dependencies from requirements.txt
- name: Build documentation
run: mkdocs build # Build the documentation
- name: Checkout site branch
run: |
if git show-ref --verify --quiet refs/heads/site; then
echo "برنچ site وجود دارد."
git checkout site
else
echo "برنچ site وجود ندارد. در حال ایجاد..."
git checkout -b site # Create and switch to the new branch
fi
git config user.name "GitHub Action"
git config user.email "[email protected]"
- name: Replace site contents
run: |
rm -rf * # Remove existing files in the site branch
echo "google-site-verification: googlee5febdfb3cd460f8.html" > googlee5febdfb3cd460f8.html
# Move new files from the build directory to the site branch only if they exist
if [ -d ../site ]; then
mv ../site/* ./ # Move new files from the build directory to the site branch
else
echo "Directory '../site' does not exist. No files to move."
fi
- name: Commit changes
run: |
git add .
git diff-index --quiet HEAD || git commit -m "Update documentation" # Only commit if there are changes
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Push changes
run: |
git remote set-url origin [email protected]:ProdByGodfather/abarorm.git
git push origin site