deploy-docs.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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@v3
  21. with:
  22. fetch-depth: 5
  23. - name: Set Up Gradle
  24. uses: spring-io/spring-gradle-build-action@v1
  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: Publish Docs
  37. 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 }}"