diff --git a/.github/check-jdk-updates.yml b/.github/check-jdk-updates.yml new file mode 100644 index 000000000..3e5f6a1b9 --- /dev/null +++ b/.github/check-jdk-updates.yml @@ -0,0 +1,64 @@ +name: Checks JDK version for minor updates + +on: + schedule: + - cron: '0 0 1 * *' # run once a month at the first day of month + +env: + JDK_VERSION: 21.0.0 + JDK_VENDOR: zulu + +jobs: + jdk-current: + name: Check out current version + runs-on: ubuntu-latest + outputs: + jdk-date: ${{ steps.get-data.outputs.jdk-date}} + steps: + - uses: actions/setup-java@v3 + with: + java-version: 21.0.0 + distribution: zulu + check-latest: false + - name: Read JAVA_VERSION_DATE and store in env variable + id: get-data + run: | + date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"') + echo "jdk-date=${date}" >> "$GITHUB_OUTPUT" + jdk-latest: + name: Checkout latest jdk version + runs-on: ubuntu-latest + outputs: + jdk-date: ${{ steps.get-data.outputs.jdk-date}} + jdk-version: ${{ steps.get-data.outputs.jdk-version}} + steps: + - uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: zulu + check-latest: true + - name: Read JAVA_VERSION_DATE and store in env variable + id: get-data + run: | + date=$(cat ${JAVA_HOME}/release | grep "JAVA_VERSION_DATE=\"" | awk -F'=' '{print $2}' | tr -d '"') + echo "jdk-date=${date}" >> "$GITHUB_OUTPUT" + version=$(cat ${JAVA_HOME}/release | grep "JAVA_RUNTIME_VERSION=\"" | awk -F'=' '{print $2}' | tr -d '"') + echo "jdk-version=${version}" >> "$GITHUB_OUTPUT" + notify: + name: Notifies for jdk update + runs-on: ubuntu-latest + needs: [jdk-current, jdk-latest] + if: ${{ needs.jdk-latest.outputs.jdk-date }} > ${{ needs.jdk-current.outputs.jdk-date }} + steps: + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_USERNAME: 'Cryptobot' + SLACK_ICON: false + SLACK_ICON_EMOJI: ':bot:' + SLACK_CHANNEL: 'cryptomator-desktop' + SLACK_TITLE: "JDK update" + SLACK_MESSAGE: "Cryptomator-CI JDK can be upgraded to ${{ needs.jdk-latest.outputs.jdk-version }}" + SLACK_FOOTER: false + MSG_MINIMAL: true \ No newline at end of file