Skip to content

Commit d986b4c

Browse files
committed
Fix docs workflow
1 parent 556f5c5 commit d986b4c

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/docs.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- uses: actions/checkout@v4.1.7
6060
with:
6161
submodules: 'true'
62+
fetch-depth: 0
6263
- name: Install poetry
6364
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
6465
- uses: actions/setup-python@v5.1.0
@@ -94,18 +95,26 @@ jobs:
9495
yarn install --frozen-lockfile
9596
yarn build
9697
cp -r ../build/html build/api
97-
- name: Fetch existing gh-pages branch
98+
- name: Prepare github_pages branch
9899
run: |
99-
git fetch origin github_pages:github_pages
100-
git checkout github_pages || git checkout -b github_pages
101-
mkdir -p docs/cyclops-webpage/build/api
100+
git config --global user.name 'GitHub Actions'
101+
git config --global user.email 'actions@github.com'
102+
git fetch origin github_pages:github_pages || git checkout --orphan github_pages
103+
git checkout github_pages
104+
git rm -rf .
105+
git clean -fxd
106+
- name: Copy built files
107+
run: |
108+
cp -R docs/cyclops-webpage/build/* .
102109
if [[ "${{ needs.check_release.outputs.is_release }}" != "true" ]]; then
110+
mkdir -p docs/cyclops-webpage/build/api
103111
git checkout github_pages -- docs/cyclops-webpage/build/api/*.html || true
104112
fi
105-
git checkout ${{ github.sha }}
106-
- name: Copy built files
113+
- name: Commit and push to github_pages
107114
run: |
108-
cp -R docs/cyclops-webpage/build/* .
115+
git add .
116+
git commit -m "Update documentation" || echo "No changes to commit"
117+
git push -f origin github_pages
109118
- name: Deploy to GitHub Pages
110119
uses: peaceiris/actions-gh-pages@v4.0.0
111120
with:

0 commit comments

Comments
 (0)