deploy-docs.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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@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: Publish Docs
  37. uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.2
  38. with:
  39. docs-username: ${{ secrets.DOCS_USERNAME }}
  40. docs-host: ${{ secrets.DOCS_HOST }}
  41. docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
  42. docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}