deploy-docs.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: Deploy Docs
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. build-refname:
  6. description: Enter git refname to build (e.g., 5.7.x).
  7. required: false
  8. push:
  9. branches: docs-build
  10. permissions: read-all
  11. jobs:
  12. build:
  13. if: github.repository_owner == 'spring-projects'
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout
  17. uses: actions/checkout@v3
  18. with:
  19. fetch-depth: 5
  20. - name: Set Up Gradle
  21. uses: spring-io/spring-gradle-build-action@v1
  22. with:
  23. java-version: '17'
  24. distribution: temurin
  25. - name: Scrub Gradle Cache
  26. # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
  27. # Restoring these files from a GitHub Actions cache might cause problems for future builds.
  28. run: |
  29. rm -f /home/runner/.gradle/caches/modules-2/modules-2.lock
  30. rm -f /home/runner/.gradle/caches/modules-2/gc.properties
  31. - name: Set up refname build
  32. if: github.event.inputs.build-refname
  33. run: |
  34. git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }}
  35. echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV
  36. echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV
  37. - name: Run Antora
  38. run: ./gradlew antora
  39. - name: Publish Docs
  40. 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 }}"