deploy-docs.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. permissions: read-all
  12. jobs:
  13. build:
  14. if: github.repository_owner == 'spring-projects'
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v3
  19. with:
  20. fetch-depth: 5
  21. - name: Set Up Gradle
  22. uses: spring-io/spring-gradle-build-action@v1
  23. with:
  24. java-version: '17'
  25. distribution: temurin
  26. - name: Scrub Gradle Cache
  27. # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
  28. # Restoring these files from a GitHub Actions cache might cause problems for future builds.
  29. run: |
  30. rm -f /home/runner/.gradle/caches/modules-2/modules-2.lock
  31. rm -f /home/runner/.gradle/caches/modules-2/gc.properties
  32. - name: Set up refname build
  33. if: github.event.inputs.build-refname
  34. run: |
  35. git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }}
  36. echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV
  37. echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV
  38. - name: Run Antora
  39. run: ./gradlew antora
  40. - name: Publish Docs
  41. run: $GITHUB_WORKSPACE/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}" "${{ secrets.CLOUDFLARE_ZONE_ID }}" "${{ secrets.CLOUDFLARE_CACHE_TOKEN }}"