Skip to content

Commit 0286c88

Browse files
committed
fix: update GitHub Pages deployment workflow to use 'site' branch instead of 'gh-pages'
1 parent 61eab50 commit 0286c88

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

.github/workflows/site.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ jobs:
7373
- name: Build Maven Site with Javadoc
7474
run: ./mvnw clean site -DskipTests -Dcheckstyle.skip=true
7575

76-
- name: Checkout gh-pages branch
76+
- name: Checkout site branch
7777
uses: actions/checkout@v6
7878
with:
79-
ref: gh-pages
80-
path: gh-pages
79+
ref: site
80+
path: site
8181
continue-on-error: true
8282

83-
- name: Initialize gh-pages if needed
83+
- name: Initialize site if needed
8484
run: |
85-
if [ ! -d "gh-pages/.git" ]; then
86-
rm -rf gh-pages
87-
mkdir -p gh-pages
88-
cd gh-pages
85+
if [ ! -d "site/.git" ]; then
86+
rm -rf site
87+
mkdir -p site
88+
cd site
8989
git init
90-
git checkout -b gh-pages
90+
git checkout -b site
9191
git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
9292
fi
9393
@@ -96,28 +96,28 @@ jobs:
9696
DEPLOY_PATH="${{ steps.version.outputs.deploy_path }}"
9797
9898
# Remove old version of this specific path (if exists)
99-
rm -rf "gh-pages/$DEPLOY_PATH"
99+
rm -rf "site/$DEPLOY_PATH"
100100
101101
# Copy new site to versioned path
102-
mkdir -p "gh-pages/$DEPLOY_PATH"
103-
cp -r target/site/* "gh-pages/$DEPLOY_PATH/"
102+
mkdir -p "site/$DEPLOY_PATH"
103+
cp -r target/site/* "site/$DEPLOY_PATH/"
104104
105105
# For releases, also update the root (latest)
106106
if [[ "${{ steps.version.outputs.is_release }}" == "true" ]] || [[ "${{ inputs.publish_as_latest }}" == "true" ]]; then
107107
# Preserve versioned folders when updating root
108-
find gh-pages -maxdepth 1 -type f -delete
109-
find gh-pages -maxdepth 1 -type d -name "[0-9]*" -prune -o -type d ! -name gh-pages ! -name snapshot ! -name .git -exec rm -rf {} + 2>/dev/null || true
108+
find site -maxdepth 1 -type f -delete
109+
find site -maxdepth 1 -type d -name "[0-9]*" -prune -o -type d ! -name site ! -name snapshot ! -name .git -exec rm -rf {} + 2>/dev/null || true
110110
111111
# Copy site to root (latest release)
112-
cp -r target/site/* gh-pages/
112+
cp -r target/site/* site/
113113
fi
114114
115115
# Copy version index page from template
116-
cp .github/templates/versions.html gh-pages/versions.html
116+
cp .github/templates/versions.html site/versions.html
117117
118118
- name: Update version list
119119
run: |
120-
cd gh-pages
120+
cd site
121121
122122
# Find all version directories
123123
VERSIONS=$(find . -maxdepth 1 -type d -name "[0-9]*" | sed 's|./||' | sort -Vr)
@@ -144,7 +144,7 @@ jobs:
144144
145145
- name: Deploy to GitHub Pages
146146
run: |
147-
cd gh-pages
147+
cd site
148148
git config user.name "github-actions[bot]"
149149
git config user.email "github-actions[bot]@users.noreply.github.com"
150150
@@ -156,7 +156,7 @@ jobs:
156156
git diff --staged --quiet || git commit -m "Deploy documentation: ${{ steps.version.outputs.deploy_path }}"
157157
158158
# Push, creating the branch if it doesn't exist
159-
git push -u origin gh-pages --force
159+
git push -u origin site --force
160160
env:
161161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162162

@@ -166,7 +166,7 @@ jobs:
166166
- name: Upload artifact
167167
uses: actions/upload-pages-artifact@v4
168168
with:
169-
path: 'gh-pages'
169+
path: 'site'
170170

171171
- name: Deploy to GitHub Pages
172172
id: deployment

0 commit comments

Comments
 (0)