release.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: "Infra: Release"
  2. on:
  3. release:
  4. types: [published]
  5. jobs:
  6. release:
  7. runs-on: ubuntu-latest
  8. outputs:
  9. version: ${{steps.build.outputs.version}}
  10. steps:
  11. - uses: actions/checkout@v3
  12. with:
  13. fetch-depth: 0
  14. ref: ${{ github.event.pull_request.head.sha }}
  15. - run: |
  16. git config user.name github-actions
  17. git config user.email github-actions@github.com
  18. - name: Set up JDK
  19. uses: actions/setup-java@v3
  20. with:
  21. java-version: '17'
  22. distribution: 'zulu'
  23. cache: 'maven'
  24. - name: Build with Maven
  25. id: build
  26. run: |
  27. ./mvnw -B -ntp versions:set -DnewVersion=${{ github.event.release.tag_name }}
  28. ./mvnw -B -V -ntp clean package -Pprod -DskipTests
  29. export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
  30. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  31. - name: Upload files to a GitHub release
  32. uses: svenstaro/upload-release-action@2.7.0
  33. with:
  34. repo_token: ${{ secrets.GITHUB_TOKEN }}
  35. file: kafka-ui-api/target/kafka-ui-api-${{ steps.build.outputs.version }}.jar
  36. tag: ${{ github.event.release.tag_name }}
  37. - name: Archive JAR
  38. uses: actions/upload-artifact@v3
  39. with:
  40. name: kafka-ui-${{ steps.build.outputs.version }}
  41. path: kafka-ui-api/target/kafka-ui-api-${{ steps.build.outputs.version }}.jar
  42. #################
  43. # #
  44. # Docker images #
  45. # #
  46. #################
  47. - name: Set up QEMU
  48. uses: docker/setup-qemu-action@v2
  49. - name: Set up Docker Buildx
  50. uses: docker/setup-buildx-action@v2
  51. - name: Cache Docker layers
  52. uses: actions/cache@v3
  53. with:
  54. path: /tmp/.buildx-cache
  55. key: ${{ runner.os }}-buildx-${{ github.sha }}
  56. restore-keys: |
  57. ${{ runner.os }}-buildx-
  58. - name: Login to DockerHub
  59. uses: docker/login-action@v2
  60. with:
  61. username: ${{ secrets.DOCKERHUB_USERNAME }}
  62. password: ${{ secrets.DOCKERHUB_TOKEN }}
  63. - name: Build and push
  64. id: docker_build_and_push
  65. uses: docker/build-push-action@v4
  66. with:
  67. builder: ${{ steps.buildx.outputs.name }}
  68. context: kafka-ui-api
  69. platforms: linux/amd64,linux/arm64
  70. provenance: false
  71. push: true
  72. tags: |
  73. provectuslabs/kafka-ui:${{ steps.build.outputs.version }}
  74. provectuslabs/kafka-ui:latest
  75. build-args: |
  76. JAR_FILE=kafka-ui-api-${{ steps.build.outputs.version }}.jar
  77. cache-from: type=local,src=/tmp/.buildx-cache
  78. cache-to: type=local,dest=/tmp/.buildx-cache
  79. charts:
  80. runs-on: ubuntu-latest
  81. needs: release
  82. steps:
  83. - name: Repository Dispatch
  84. uses: peter-evans/repository-dispatch@v2
  85. with:
  86. token: ${{ secrets.CHARTS_ACTIONS_TOKEN }}
  87. repository: provectus/kafka-ui-charts
  88. event-type: prepare-helm-release
  89. client-payload: '{"appversion": "${{ needs.release.outputs.version }}"}'