check-jdk-updates.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. workflow_dispatch:
  6. env:
  7. JDK_VERSION: '23.0.1+11'
  8. JDK_VENDOR: zulu
  9. jobs:
  10. jdk-current:
  11. name: Check out current version
  12. runs-on: ubuntu-latest
  13. outputs:
  14. jdk-date: ${{ steps.get-data.outputs.jdk-date}}
  15. steps:
  16. - uses: actions/setup-java@v4
  17. with:
  18. java-version: ${{ env.JDK_VERSION }}
  19. distribution: ${{ env.JDK_VENDOR }}
  20. check-latest: false
  21. - name: Read JAVA_VERSION_DATE and store in env variable
  22. id: get-data
  23. run: |
  24. date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"')
  25. echo "jdk-date=${date}" >> "$GITHUB_OUTPUT"
  26. jdk-latest:
  27. name: Checkout latest jdk version
  28. runs-on: ubuntu-latest
  29. env:
  30. JDK_MAJOR_VERSION: 23
  31. outputs:
  32. jdk-date: ${{ steps.get-data.outputs.jdk-date}}
  33. jdk-version: ${{ steps.get-data.outputs.jdk-version}}
  34. steps:
  35. - name: Extract major version
  36. run: echo 'JDK_MAJOR_VERSION=${{ env.JDK_VERSION }}'.substring(0,20) >> "$env:GITHUB_ENV"
  37. shell: pwsh
  38. - uses: actions/setup-java@v4
  39. with:
  40. java-version: ${{ env.JDK_MAJOR_VERSION}}
  41. distribution: ${{ env.JDK_VENDOR }}
  42. check-latest: true
  43. - name: Read JAVA_VERSION_DATE and store in env variable
  44. id: get-data
  45. run: |
  46. date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"')
  47. echo "jdk-date=${date}" >> "$GITHUB_OUTPUT"
  48. version=$(cat ${JAVA_HOME}/release | grep "JAVA_RUNTIME_VERSION=\"" | awk -F'=' '{print $2}' | tr -d '"')
  49. echo "jdk-version=${version}" >> "$GITHUB_OUTPUT"
  50. notify:
  51. name: Notifies for jdk update
  52. runs-on: ubuntu-latest
  53. needs: [jdk-current, jdk-latest]
  54. if: ${{ needs.jdk-latest.outputs.jdk-date }} > ${{ needs.jdk-current.outputs.jdk-date }}
  55. steps:
  56. - name: Slack Notification
  57. uses: rtCamp/action-slack-notify@v2
  58. env:
  59. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  60. SLACK_USERNAME: 'Cryptobot'
  61. SLACK_ICON: false
  62. SLACK_ICON_EMOJI: ':bot:'
  63. SLACK_CHANNEL: 'cryptomator-desktop'
  64. SLACK_TITLE: "JDK update available"
  65. 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."
  66. SLACK_FOOTER: false
  67. MSG_MINIMAL: true