deploy-docs.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: read-all
  14. jobs:
  15. build:
  16. if: github.repository_owner == 'spring-projects'
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v5
  21. with:
  22. fetch-depth: 5
  23. - name: Set Up Gradle
  24. uses: spring-io/spring-gradle-build-action@v2
  25. with:
  26. java-version: '17'
  27. distribution: temurin
  28. - name: Set up refname build
  29. if: github.event.inputs.build-refname
  30. run: |
  31. git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }}
  32. echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV
  33. echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV
  34. - name: Run Antora
  35. run: ./gradlew antora
  36. - name: Copy the cache to be included in the site
  37. run: cp -rf build/antora/inject-collector-cache-config-extension/.cache build/site/
  38. - name: Publish Docs
  39. uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.20
  40. with:
  41. docs-username: ${{ secrets.DOCS_USERNAME }}
  42. docs-host: ${{ secrets.DOCS_HOST }}
  43. docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
  44. docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}
  45. - name: Bust Clouflare Cache
  46. uses: spring-io/spring-doc-actions/bust-cloudflare-antora-cache@v0.0.20
  47. with:
  48. context-root: spring-security
  49. cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
  50. cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}