-
Notifications
You must be signed in to change notification settings - Fork 116
83 lines (71 loc) · 2.33 KB
/
build-docs.yml
File metadata and controls
83 lines (71 loc) · 2.33 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
name: Build and Deploy Documentation
on:
push:
branches:
- master
- dev
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
name: Build AsciiDoc documentation site
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install Asciidoctor
run: |
gem install asciidoctor
gem install asciidoctor-diagram
- name: Install Python dependencies
run: pip install pyyaml jinja2
- name: Set output directory based on branch
id: set-output-dir
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
echo "output_dir=docs" >> $GITHUB_OUTPUT
echo "base_url=" >> $GITHUB_OUTPUT
else
echo "output_dir=docs/dev" >> $GITHUB_OUTPUT
echo "base_url=/dev" >> $GITHUB_OUTPUT
fi
- name: Build documentation site
run: |
chmod +x scripts/build-docs.sh
if [ "${{ github.ref_name }}" == "dev" ]; then
./scripts/build-docs.sh ${{ steps.set-output-dir.outputs.output_dir }} --dev
else
./scripts/build-docs.sh ${{ steps.set-output-dir.outputs.output_dir }}
fi
- name: Checkout gh-pages branch for merging
if: github.ref_name == 'dev'
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages-existing
- name: Merge dev docs into existing gh-pages
if: github.ref_name == 'dev'
run: |
# Copy existing gh-pages content (master version)
mkdir -p final-docs
cp -r gh-pages-existing/* final-docs/ 2>/dev/null || true
# Remove old dev folder if exists
rm -rf final-docs/dev
# Copy new dev docs
cp -r docs/dev final-docs/dev
# Move final-docs to docs for deployment
rm -rf docs
mv final-docs docs
- name: Add CNAME for custom domain
run: echo 'sdrf.quantms.org' > docs/CNAME
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/