Skip to content

Commit 0918895

Browse files
authored
ci: Adjust workflows and scripts for artifact handling (#87)
Refactor disk space reclamation scripts and workflows to use a consistent path. Add step to fetch existing GitHub Pages artifact in docs workflow. Update existingVersionsFile to point to local build directory. Signed-off-by: Eric Deandrea <[email protected]>
1 parent d343a4f commit 0918895

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
echo "Fetching latest pages deployment..."
4+
5+
# Get the latest successful pages deployment
6+
ARTIFACT_ID=$(gh api "/repos/${REPO}/actions/artifacts?name=github-pages" --jq '.artifacts[0].id')
7+
8+
if [ -n "$ARTIFACT_ID" ] && [ "$ARTIFACT_ID" != "null" ]; then
9+
echo "Found artifact ID: $ARTIFACT_ID"
10+
11+
# Download the artifact
12+
gh api "/repos/${REPO}/actions/artifacts/${ARTIFACT_ID}/zip" > artifact.zip
13+
14+
# Extract to build directory
15+
mkdir -p docs/build/mkdocs
16+
unzip -o artifact.zip -d /tmp/pages-artifact
17+
tar -xzf /tmp/pages-artifact/artifact.tar -C docs/build/mkdocs
18+
19+
echo "Successfully extracted existing pages"
20+
else
21+
echo "No existing artifact found, this may be the first deployment"
22+
fi

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- name: Reclaim disk space
5858
working-directory: .github
5959
shell: bash
60-
run: ./ci-reclaim-disk-space.sh
60+
run: scripts/ci-reclaim-disk-space.sh
6161

6262
- name: Set up Java ${{ matrix.java }}
6363
uses: actions/setup-java@v5
@@ -88,7 +88,7 @@ jobs:
8888
- uses: actions/checkout@v6
8989

9090
- name: Reclaim disk space
91-
working-directory: .github
91+
working-directory: .github/scripts
9292
shell: bash
9393
run: ./ci-reclaim-disk-space.sh
9494

@@ -123,7 +123,7 @@ jobs:
123123
- uses: actions/checkout@v6
124124

125125
- name: Reclaim disk space
126-
working-directory: .github
126+
working-directory: .github/scripts
127127
shell: bash
128128
run: ./ci-reclaim-disk-space.sh
129129

.github/workflows/docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ jobs:
4545
distribution: temurin
4646
cache: gradle
4747

48+
- name: Download existing GitHub Pages artifact
49+
continue-on-error: true
50+
working-directory: .github/scripts
51+
env:
52+
GH_TOKEN: ${{ github.token }}
53+
REPO: ${{ github.repository }}
54+
run: ./get-current-gh-pages.sh
55+
4856
- name: Generate documentation
4957
run: ./gradlew --console=plain :docs:build
5058

.github/workflows/version-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- uses: actions/checkout@v6
6363

6464
- name: Reclaim disk space
65-
working-directory: .github
65+
working-directory: .github/scripts
6666
shell: bash
6767
run: ./ci-reclaim-disk-space.sh
6868

docs/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mkdocs {
3535
org.codehaus.groovy.runtime.InvokerHelper.setProperty(this, "versionAliases", arrayOf("dev"))
3636
rootRedirectTo = "dev"
3737
generateVersionsFile = true
38-
existingVersionsFile = "https://docling-project.github.io/docling-java/versions.json"
38+
existingVersionsFile = layout.buildDirectory.dir("mkdocs").get().file("versions.json").asFile.absolutePath
3939
}
4040
}
4141

0 commit comments

Comments
 (0)