File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed
Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,6 @@ notifications:
38383939404041+ publish :
42+ whoami : asf-site
43+ subdir : java
Original file line number Diff line number Diff line change @@ -471,6 +471,71 @@ 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+ if : >-
483+ github.event_name == 'push' &&
484+ github.ref_type == 'branch' &&
485+ ((github.repository == 'apache/arrow-java' && github.ref_name == 'main') ||
486+ github.repository != 'apache/arrow-java')
487+ needs :
488+ - docs
489+ runs-on : ubuntu-latest
490+ permissions :
491+ contents : write
492+ steps :
493+ - name : Checkout
494+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
495+ with :
496+ path : site
497+ persist-credentials : true
498+ - name : Prepare branch
499+ run : |
500+ if [ "${GITHUB_REPOSITORY}" = "apache/arrow-java" ]; then
501+ BRANCH=asf-site
502+ else
503+ BRANCH=gh-pages
504+ fi
505+ echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV}
506+
507+ cp site/.asf.yaml ./
508+ cd site
509+ git fetch
510+ if ! git switch -c "${BRANCH}" "origin/${BRANCH}"; then
511+ git switch --orphan "${BRANCH}"
512+ fi
513+ cp ../.asf.yaml ./
514+ git add .asf.yaml
515+ - name : Download
516+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
517+ with :
518+ name : release-html
519+ - name : Extract
520+ run : |
521+ tar -xf html.tar.gz
522+ rm -rf site/main
523+ mv html site/main
524+ git -C site add main
525+ if [ "$(git status --prcelain)" == "" ]; then
526+ NEED_PUSH=true
527+ else
528+ NEED_PUSH=false
529+ fi
530+ echo "NEED_PUSH=${NEED_PUSH}" >> ${GITHUB_ENV}
531+ - name : Push
532+ if : env.NEED_PUSH == 'true'
533+ run : |
534+ cd site
535+ git config --global user.name 'github-actions[bot]'
536+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
537+ git commit -m "Publish documentation (${GITHUB_SHA})"
538+ git push origin "${BRANCH}"
474539 verify :
475540 name : Verify
476541 needs :
You can’t perform that action at this time.
0 commit comments