|
| 1 | +name: Deploy Docs |
| 2 | +run-name: ${{ format('{0} ({1})', github.workflow, github.event.inputs.build-refname || 'all') }} |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + build-refname: |
| 7 | + description: Enter git refname to build (e.g., 5.7.x). |
| 8 | + required: false |
| 9 | + push: |
| 10 | + branches: docs-build |
| 11 | +env: |
| 12 | + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + if: github.repository_owner == 'spring-projects' |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v3 |
| 22 | + with: |
| 23 | + fetch-depth: 5 |
| 24 | + - name: Set up JDK 17 |
| 25 | + uses: actions/setup-java@v3 |
| 26 | + with: |
| 27 | + java-version: '17' |
| 28 | + distribution: 'temurin' |
| 29 | + - name: Set up refname build |
| 30 | + if: github.event.inputs.build-refname |
| 31 | + run: | |
| 32 | + git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }} |
| 33 | + export BUILD_REFNAME=${{ github.event.inputs.build-refname }} |
| 34 | + echo "BUILD_REFNAME=$BUILD_REFNAME" >> $GITHUB_ENV |
| 35 | + 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)") |
| 36 | + echo BUILD_VERSION=$BUILD_VERSION >> $GITHUB_ENV |
| 37 | + - name: Run Antora |
| 38 | + run: | |
| 39 | + ./mvnw antora |
| 40 | + - name: Publish Docs |
| 41 | + uses: spring-io/spring-doc-actions/[email protected] |
| 42 | + with: |
| 43 | + docs-username: ${{ secrets.DOCS_USERNAME }} |
| 44 | + docs-host: ${{ secrets.DOCS_HOST }} |
| 45 | + docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }} |
| 46 | + docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }} |
| 47 | + site-path: target/site |
| 48 | + - name: Bust Cloudflare Cache |
| 49 | + uses: spring-io/spring-doc-actions/[email protected] |
| 50 | + with: |
| 51 | + context-root: spring-batch |
| 52 | + cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }} |
| 53 | + cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} |
0 commit comments