deploy-docs.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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., 1.2.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@v5
  22. with:
  23. fetch-depth: 5
  24. - name: Set Up Gradle
  25. uses: spring-io/spring-gradle-build-action@v2
  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. echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV
  34. echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV
  35. - name: Run Antora
  36. run: ./gradlew antora
  37. - name: Copy the cache to be included in the site
  38. run: cp -rf build/antora/inject-collector-cache-config-extension/.cache build/site/
  39. - name: Publish Docs
  40. uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.20
  41. with:
  42. docs-username: ${{ secrets.DOCS_USERNAME }}
  43. docs-host: ${{ secrets.DOCS_HOST }}
  44. docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
  45. docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}
  46. - name: Bust Clouflare Cache
  47. uses: spring-io/spring-doc-actions/bust-cloudflare-antora-cache@v0.0.20
  48. with:
  49. context-root: spring-authorization-server
  50. cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
  51. cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}