Deploy Docs (main) #915
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Docs | |
| run-name: ${{ format('{0} ({1})', github.workflow, github.event.inputs.build-refname || 'all') }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build-refname: | |
| description: Enter git refname to build (e.g., 5.7.x). | |
| required: false | |
| push: | |
| branches: docs-build | |
| permissions: read-all | |
| jobs: | |
| build: | |
| if: github.repository_owner == 'spring-projects' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| # required for Antora to use the cloned repository to build | |
| fetch-depth: 0 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Set up refname build | |
| if: github.event.inputs.build-refname | |
| run: | | |
| git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }} | |
| export BUILD_REFNAME=${{ github.event.inputs.build-refname }} | |
| echo "BUILD_REFNAME=$BUILD_REFNAME" >> $GITHUB_ENV | |
| export BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:pom.xml | python3 -c "import xml.etree.ElementTree as xml; from sys import stdin; print(xml.parse(stdin).getroot().find('{http://maven.apache.org/POM/4.0.0}version').text)") | |
| echo BUILD_VERSION=$BUILD_VERSION >> $GITHUB_ENV | |
| - name: Run Antora | |
| run: | | |
| ./mvnw --no-transfer-progress --batch-mode antora | |
| - name: Publish Docs | |
| uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.20 | |
| with: | |
| docs-username: ${{ secrets.DOCS_USERNAME }} | |
| docs-host: ${{ secrets.DOCS_HOST }} | |
| docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }} | |
| docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }} | |
| site-path: target/site | |
| - name: Bust Cloudflare Cache | |
| uses: spring-io/spring-doc-actions/bust-cloudflare-antora-cache@v0.0.20 | |
| with: | |
| context-root: spring-batch | |
| cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
| cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} |