upload-docs.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: Build and upload docs
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - 3.1.x
  7. - 3.0.x
  8. - 2.4.x
  9. - 2.3.x
  10. - 2.2.x
  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 8
  28. uses: actions/setup-java@v4
  29. with:
  30. java-version: 8
  31. distribution: 'adopt'
  32. cache: 'maven'
  33. - uses: actions/cache@v1
  34. with:
  35. path: ~/.m2/repository
  36. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  37. restore-keys: |
  38. ${{ runner.os }}-maven-
  39. - name: Build docs
  40. run: ./mvnw clean package javadoc:aggregate -Pdocs-classic,spring -DskipTests=true -e
  41. - name: Upload to S3
  42. env:
  43. AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_ACCESS_KEY }}
  44. AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_KEY }}
  45. run: |
  46. aws s3 sync --acl public-read docs/target/generated-docs/ s3://awspring-docs/spring-cloud-aws/docs/
  47. aws s3 sync --acl public-read target/site/ s3://awspring-docs/spring-cloud-aws/docs/
  48. aws cloudfront create-invalidation --distribution-id EA7LER7CI960A --paths "/*"