Skip to content

Commit 4d5bdf3

Browse files
authored
ci: Switch to gh-pages branch (#111)
Remove obsolete script for downloading artifacts and replace it with a PR-based publishing approach. Streamline workflows by adjusting checkout paths and adding steps for automated documentation updates. Signed-off-by: Eric Deandrea <[email protected]>
1 parent cca9263 commit 4d5bdf3

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

.github/scripts/get-current-gh-pages.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,21 @@ jobs:
4747
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
4848
with:
4949
fetch-depth: 0
50+
path: app
5051

5152
- name: Get release sources
5253
if: github.event_name == 'release'
5354
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
5455
with:
5556
fetch-depth: 0
5657
ref: ${{ github.event.release.tag_name }}
58+
path: app
59+
60+
- name: Get docs
61+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
62+
with:
63+
ref: gh-pages
64+
path: docs
5765

5866
- name: Setup Python
5967
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
@@ -69,24 +77,38 @@ jobs:
6977
- name: Setup Gradle
7078
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
7179

72-
- name: Download existing GitHub Pages artifact
73-
continue-on-error: true
74-
env:
75-
GH_TOKEN: ${{ github.token }}
76-
REPO: ${{ github.repository }}
77-
run: .github/scripts/get-current-gh-pages.sh
78-
7980
- name: Generate documentation
81+
working-directory: app
8082
run: ./gradlew --console=plain :docs:build -Pdocs.alias=${{ env.DOCS_ALIAS }}
8183

82-
- name: Setup pages
83-
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
84+
- name: Copy to gh-pages
85+
run: cp -Rf app/docs/build/mkdocs/ docs/
8486

85-
- name: Upload artifact
86-
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
87+
- uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
88+
id: app-token
8789
with:
88-
path: docs/build/mkdocs
90+
app-id: ${{ vars.DOCLING_JAVA_CI_APP_ID }}
91+
private-key: ${{ secrets.DOCLING_JAVA_CI_PRIVATE_KEY }}
8992

90-
- name: Deploy to GH Pages
91-
id: deployment
92-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
93+
- name: Create PR
94+
id: create-pr
95+
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
96+
with:
97+
token: ${{ steps.app-token.outputs.token }}
98+
add-paths: .
99+
commit-message: "docs: Build and publish docs (from ${{ github.workflow }} run # ${{ github.run_number }})"
100+
branch: build-docs/sourceref
101+
branch-suffix: short-commit-hash
102+
delete-branch: true
103+
base: gh-pages
104+
signoff: true
105+
sign-commits: true
106+
title: "docs: Build and publish docs (from ${{ github.workflow }} run # ${{ github.run_number }})"
107+
body: "docs: Build and publish docs from [${{ github.workflow }} run # ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}), which was triggered by commit ${{ env.REF }}."
108+
labels: documentation
109+
110+
- name: Merge PR
111+
if: (steps.create-pr.outputs.pull-request-operation == 'created') && steps.create-pr.outputs.pull-request-number
112+
env:
113+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
114+
run: gh pr merge --merge --admin --delete-branch "${{ steps.create-pr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)