Skip to content

Commit 30a6c2d

Browse files
committed
new changes
Signed-off-by: SGudla <[email protected]>
1 parent c952420 commit 30a6c2d

File tree

4 files changed

+57
-54
lines changed

4 files changed

+57
-54
lines changed

.github/workflows/documentation.yaml .github/workflows/build-doc.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
popd
2929
3030
echo "Sphinx was generated successfully!"
31+
32+
- name: Store the generated doc
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: html-sphinix
36+
path: doc/sphinix/build
3137

3238
- name: Doxygen build
3339
run: |
@@ -39,4 +45,10 @@ jobs:
3945
cd ..
4046
popd
4147
42-
echo "Doxygen was generated successfully!"
48+
echo "Doxygen was generated successfully!"
49+
50+
- name: Store the generated doc
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: html-doxygen
54+
path: doc/doxygen/build/html

.github/workflows/deploy-doc.yaml

+41-50
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,46 @@
11
name: Deploy Doc
22

33
on: workflow_call
4-
jobs:
5-
deploy-docs:
4+
jobs:
5+
deploy-doc:
66
runs-on: ubuntu-latest
7-
# needs: docs
8-
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/sphinx-web-documentation')
7+
permissions:
8+
contents: write
9+
910
steps:
10-
- name: Update gh pages
11-
run: |
12-
git config --global user.email "[email protected]"
13-
git config --global user.name "CSE-CI"
14-
15-
MASTER_COMMIT=$(git rev-parse --short HEAD)
16-
REPO_SLUG="${REPO_SLUG:-analogdevicesinc/precision-converters-firmware}"
17-
18-
# Fetch and checkout to gh-pages branch
19-
git fetch --depth 1 origin +refs/heads/gh-pages:gh-pages
20-
git checkout gh-pages
21-
22-
# Clear previous content in the root folder of 'gh-pages' branch except
23-
# the 'doc' folder which holds new builds
24-
find -mindepth 1 -maxdepth 1 ! \( -name "doc" -o -name ".git" \) -exec rm -rf {} \;
25-
26-
# Add sphinx build html content to root folder in the 'gh-pages' branch
27-
cp -r doc/sphinx/build/* ./
28-
29-
# Create doxygen folder holding new build content and add doxygen html content
30-
# to doxygen/ folder in the 'gh-pages' branch
31-
mkdir -p doxygen
32-
cp -r doc/doxygen/build/html/* doxygen/
33-
34-
# Remove temporary 'doc' folder
35-
rm -rf doc/
36-
37-
# Create .nojekyll file to handle files starting with '_' on gh pages
38-
touch .nojekyll
39-
40-
# Push contents to 'gh-pages' branch
41-
CURRENT_COMMIT=$(git log -1 --pretty=%B)
42-
if [[ ${CURRENT_COMMIT:(-7)} != ${MASTER_COMMIT:0:7} ]]
43-
then
44-
git add --all .
45-
git commit --allow-empty --amend -m "Update documentation to ${MASTER_COMMIT:0:7}"
46-
if [ -n "$GITHUB_DOC_TOKEN" ] ; then
47-
git push https://${GITHUB_DOC_TOKEN}@github.com/${REPO_SLUG} gh-pages -f
48-
else
49-
git push origin gh-pages -f
50-
fi
51-
52-
echo "Documetation updated!"
53-
else
54-
echo "Documentation already up to date!"
55-
fi
11+
- uses: actions/checkout@v4
12+
ref: 'gh-pages'
13+
14+
- name: Empty gh-pages
15+
run: |
16+
git rm -r . --quiet
17+
18+
- uses: actions/download-artifact@v4
19+
with:
20+
name: html-sphinx
21+
22+
- uses: actions/download-artifact@v4
23+
with:
24+
name: html-doxygen
25+
path: doxygen
26+
27+
- name: Patch doc build
28+
run: |
29+
rm -r _sources
30+
touch .nojekyll
31+
32+
- name: Commit gh-pages
33+
run: |
34+
author=$(git log -1 --pretty=format:'%an')
35+
email=$(git log -1 --pretty=format:'%ae')
36+
commit=$(git rev-parse --short HEAD)
37+
38+
git add . >> /dev/null
39+
git config --global user.name "$author"
40+
git config --global user.email "$email"
41+
git commit -m "deploy: $commit" --allow-empty
42+
43+
44+
- name: Push to gh-pages
45+
run: >-
46+
git push origin gh-pages:gh-pages

.github/workflows/main.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
needs: [check-versions]
1717
secrets: inherit
1818
documentation:
19-
uses: ./.github/workflows/documentation.yaml
19+
uses: ./.github/workflows/build-doc.yaml
2020
needs: [lint]
2121
secrets: inherit
2222
deploy-doc:
2323
uses: ./.github/workflows/deploy-doc.yaml
24-
needs: [documentation]
24+
needs: [build-doc]
2525
secrets: inherit

.github/workflows/pr.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
needs: [check-versions]
1515
secrets: inherit
1616
documentation:
17-
uses: ./.github/workflows/documentation.yaml
17+
uses: ./.github/workflows/build-doc.yaml
1818
needs: [lint]
1919
secrets: inherit

0 commit comments

Comments
 (0)