upload-docs.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Build and upload docs
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - 3.0.x
  7. - 2.4.x
  8. - 2.3.x
  9. - 2.2.x
  10. - fix-build-docs
  11. env:
  12. # https://github.com/actions/checkout/issues/440#issuecomment-854240996
  13. AWS_EC2_METADATA_DISABLED: true
  14. permissions:
  15. contents: read
  16. jobs:
  17. build:
  18. runs-on: ubuntu-22.04
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Set up JDK 17
  22. uses: sdkman/sdkman-action@master
  23. id: sdkman
  24. with:
  25. candidate: java
  26. version: '17.0.1-tem'
  27. - name: Set up JDK
  28. uses: actions/setup-java@v4
  29. with:
  30. java-version: 17
  31. distribution: 'jdkfile'
  32. jdkFile: ${{ steps.sdkman.outputs.file }}
  33. cache: 'maven'
  34. - uses: actions/cache@v1
  35. with:
  36. path: ~/.m2/repository
  37. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  38. restore-keys: |
  39. ${{ runner.os }}-maven-
  40. - name: Build docs
  41. run: ./mvnw clean package javadoc:aggregate -Pdocs-classic,spring -DskipTests=true -e
  42. - name: Upload to S3
  43. env:
  44. AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_ACCESS_KEY }}
  45. AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_KEY }}
  46. run: |
  47. aws s3 sync --acl public-read /home/runner/work/spring-cloud-aws/spring-cloud-aws/docs/target/generated-docs/ s3://awspring-docs/spring-cloud-aws/docs/
  48. aws s3 sync --acl public-read /home/runner/work/spring-cloud-aws/spring-cloud-aws/target/site/ s3://awspring-docs/spring-cloud-aws/docs/
  49. aws cloudfront create-invalidation --distribution-id EA7LER7CI960A --paths "/*"