check-jdk-updates.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: Checks JDK version for minor updates
  2. on:
  3. schedule:
  4. - cron: '0 0 1 * *' # run once a month at the first day of month
  5. env:
  6. JDK_VERSION: '22.0.1+8'
  7. JDK_VENDOR: zulu
  8. jobs:
  9. jdk-current:
  10. name: Check out current version
  11. runs-on: ubuntu-latest
  12. outputs:
  13. jdk-date: ${{ steps.get-data.outputs.jdk-date}}
  14. steps:
  15. - uses: actions/setup-java@v4
  16. with:
  17. java-version: ${{ env.JDK_VERSION }}
  18. distribution: ${{ env.JDK_VENDOR }}
  19. check-latest: false
  20. - name: Read JAVA_VERSION_DATE and store in env variable
  21. id: get-data
  22. run: |
  23. date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"')
  24. echo "jdk-date=${date}" >> "$GITHUB_OUTPUT"
  25. jdk-latest:
  26. name: Checkout latest jdk version
  27. runs-on: ubuntu-latest
  28. outputs:
  29. jdk-date: ${{ steps.get-data.outputs.jdk-date}}
  30. jdk-version: ${{ steps.get-data.outputs.jdk-version}}
  31. steps:
  32. - uses: actions/setup-java@v4
  33. with:
  34. java-version: 21
  35. distribution: ${{ env.JDK_VENDOR }}
  36. check-latest: true
  37. - name: Read JAVA_VERSION_DATE and store in env variable
  38. id: get-data
  39. run: |
  40. date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"')
  41. echo "jdk-date=${date}" >> "$GITHUB_OUTPUT"
  42. version=$(cat ${JAVA_HOME}/release | grep "JAVA_RUNTIME_VERSION=\"" | awk -F'=' '{print $2}' | tr -d '"')
  43. echo "jdk-version=${version}" >> "$GITHUB_OUTPUT"
  44. notify:
  45. name: Notifies for jdk update
  46. runs-on: ubuntu-latest
  47. needs: [jdk-current, jdk-latest]
  48. if: ${{ needs.jdk-latest.outputs.jdk-date }} > ${{ needs.jdk-current.outputs.jdk-date }}
  49. steps:
  50. - name: Slack Notification
  51. uses: rtCamp/action-slack-notify@v2
  52. env:
  53. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  54. SLACK_USERNAME: 'Cryptobot'
  55. SLACK_ICON: false
  56. SLACK_ICON_EMOJI: ':bot:'
  57. SLACK_CHANNEL: 'cryptomator-desktop'
  58. SLACK_TITLE: "JDK update available"
  59. SLACK_MESSAGE: "Cryptomator-CI JDK can be upgraded to ${{ needs.jdk-latest.outputs.jdk-version }}. See https://github.com/cryptomator/cryptomator/wiki/How-to-update-the-build-JDK for instructions."
  60. SLACK_FOOTER: false
  61. MSG_MINIMAL: true