-
Notifications
You must be signed in to change notification settings - Fork 69
98 lines (87 loc) · 3.36 KB
/
deploy-docs.yml
File metadata and controls
98 lines (87 loc) · 3.36 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Deploy MkDocs Documentation
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Debug directory structure
run: |
echo "Current directory:"
pwd
echo "Files and directories at root level:"
ls -la
echo "Check for datamule directory:"
test -d datamule && echo "datamule directory exists" || echo "datamule directory does NOT exist"
if [ -d datamule ]; then
echo "Contents of datamule directory:"
ls -la datamule/
echo "Check for docs-rewrite in datamule:"
test -d datamule/docs-rewrite && echo "datamule/docs-rewrite exists" || echo "datamule/docs-rewrite does NOT exist"
fi
echo "Check for docs-rewrite at root:"
test -d docs-rewrite && echo "docs-rewrite exists at root" || echo "docs-rewrite does NOT exist at root"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material pymdown-extensions
- name: Build Documentation
run: |
# Try datamule/docs-rewrite first, fall back to docs-rewrite if the first fails
if [ -d datamule/docs-rewrite ]; then
echo "Building from datamule/docs-rewrite"
cd datamule/docs-rewrite
mkdocs build
elif [ -d docs-rewrite ]; then
echo "Building from docs-rewrite"
cd docs-rewrite
mkdocs build
else
echo "ERROR: Could not find docs-rewrite directory"
exit 1
fi
- name: Check Build Directory
run: |
echo "Current directory:"
pwd
echo "Checking build output directories:"
if [ -d datamule/docs-rewrite/site ]; then
echo "Found build output in datamule/docs-rewrite/site:"
ls -la datamule/docs-rewrite/site
echo "Will use this as publish directory"
echo "publish_dir=./datamule/docs-rewrite/site" >> $GITHUB_ENV
elif [ -d docs-rewrite/site ]; then
echo "Found build output in docs-rewrite/site:"
ls -la docs-rewrite/site
echo "Will use this as publish directory"
echo "publish_dir=./docs-rewrite/site" >> $GITHUB_ENV
else
echo "ERROR: Could not find build output directory"
exit 1
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.publish_dir }}
force_orphan: true # This ensures a fresh history
enable_jekyll: false
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'Deploy MkDocs documentation [skip ci]'
full_commit_message: |
Deploy MkDocs documentation
Build from ${{ github.sha }}
Triggered by ${{ github.event_name }}