@@ -471,6 +471,74 @@ jobs:
471471 with :
472472 name : release-html
473473 path : html.tar.gz
474+ public-docs :
475+ name : Publish docs
476+ # Run only when:
477+ # * We push to a branch
478+ # * If the target repository is apache/arrow-java:
479+ # * The target branch is main
480+ # * Else (fork repositories):
481+ # * All branches
482+ # * We can preview the last pushed content
483+ # at https://${YOUR_GITHUB_ACCOUNT}.github.io/arrow-java/main/
484+ if : >-
485+ github.event_name == 'push' &&
486+ github.ref_type == 'branch' &&
487+ ((github.repository == 'apache/arrow-java' && github.ref_name == 'main') ||
488+ github.repository != 'apache/arrow-java')
489+ needs :
490+ - docs
491+ runs-on : ubuntu-latest
492+ permissions :
493+ contents : write
494+ steps :
495+ - name : Checkout
496+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
497+ with :
498+ path : site
499+ persist-credentials : true
500+ - name : Prepare branch
501+ run : |
502+ if [ "${GITHUB_REPOSITORY}" = "apache/arrow-java" ]; then
503+ BRANCH=asf-site
504+ else
505+ BRANCH=gh-pages
506+ fi
507+ echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV}
508+
509+ cp site/.asf.yaml ./
510+ cd site
511+ git fetch
512+ if ! git switch -c "${BRANCH}" "origin/${BRANCH}"; then
513+ git switch --orphan "${BRANCH}"
514+ fi
515+ touch .nojekyll
516+ cp ../.asf.yaml ./
517+ git add .nojekyll .asf.yaml
518+ - name : Download
519+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
520+ with :
521+ name : release-html
522+ - name : Extract
523+ run : |
524+ tar -xf html.tar.gz
525+ rm -rf site/main
526+ mv html site/main
527+ git -C site add main
528+ if [ "$(git status --prcelain)" == "" ]; then
529+ NEED_PUSH=true
530+ else
531+ NEED_PUSH=false
532+ fi
533+ echo "NEED_PUSH=${NEED_PUSH}" >> ${GITHUB_ENV}
534+ - name : Push
535+ if : env.NEED_PUSH == 'true'
536+ run : |
537+ cd site
538+ git config --global user.name 'github-actions[bot]'
539+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
540+ git commit -m "Publish documentation (${GITHUB_SHA})"
541+ git push origin "${BRANCH}"
474542 verify :
475543 name : Verify
476544 needs :
0 commit comments