-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (60 loc) · 1.88 KB
/
publish-docs.yml
File metadata and controls
77 lines (60 loc) · 1.88 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
name: Publish Docs
on:
push:
branches:
- main
tags:
- '*dev*' # Match x.x.xxdevx style tags
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# 1. MAIN BRANCH DEPLOYMENT (Production)
publish-main:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: BEE Install and Build Docs
run: ./ci/docs.sh
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/sphinx/_build/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# 2. TAGGED DEV RELEASE DEPLOYMENT
publish-dev-tag:
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'dev')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure tags are available
- name: Get Tag Name
id: tag
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build Docs
run: ./ci/docs.sh
- name: Deploy versioned dev docs to subdir
run: |
TAG_NAME=${{ steps.tag.outputs.TAG_NAME }}
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git clone --depth=1 --branch gh-pages https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages
cd gh-pages
mkdir -p $TAG_NAME
rm -rf $TAG_NAME/*
cp -r ../docs/sphinx/_build/html/* $TAG_NAME/
touch .nojekyll
git add .
git commit -m "Deploy docs for $TAG_NAME"
git push origin gh-pages