Build and Deploy Documentation (main) #8337
This file contains 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: Build and Deploy Documentation | |
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 | |
env: | |
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} | |
permissions: read-all | |
jobs: | |
build-and-deploy-docs: | |
name: Build and Deploy Documentation | |
if: github.repository_owner == 'spring-projects' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 5 | |
- name: Set Up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
- name: Set Up Gradle | |
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3.5.0 | |
with: | |
cache-read-only: false | |
- 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 }} | |
echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV | |
echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV | |
- name: Run Antora | |
run: ./gradlew antora | |
- name: Copy the cache to be included in the site | |
run: cp -rf build/antora/inject-collector-cache-config-extension/.cache build/site/ | |
- name: Publish Docs | |
uses: spring-io/spring-doc-actions/[email protected] | |
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 }} | |
- name: Bust Cloudflare Cache | |
uses: spring-io/spring-doc-actions/[email protected] | |
with: | |
context-root: spring-framework | |
cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} |