Skip to content

update Mbedtls to the latest version #67

update Mbedtls to the latest version

update Mbedtls to the latest version #67

name: update Mbedtls to the latest version
on:
schedule: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '0 1 * * 1' # run every monday at 01:00
workflow_dispatch: # allow manual triggering if needed
jobs:
get-mbedtls-version:
runs-on: ubuntu-latest
outputs:
currentMbedtlsVersion: ${{ steps.step1.outputs.currentMbedtlsVersion }}
latestMbedtlsVersion: ${{ steps.step1.outputs.latestMbedtlsVersion }}
steps:
- uses: actions/checkout@v4
- id: step1
run: |
echo -n "latestMbedtlsVersion=" >> "$GITHUB_OUTPUT"
curl -s https://api.github.com/repos/Mbed-TLS/mbedtls/releases/latest | jq -r '.tag_name' | grep -o '[0-9.]\+$' >> "$GITHUB_OUTPUT"
echo -n "currentMbedtlsVersion=" >> "$GITHUB_OUTPUT"
cat kotlin-mbedtls/src/main/resources/mbedtls.properties | grep -o '^mbedtlsVersion=.*' | cut -d= -f2 >> "$GITHUB_OUTPUT"
compile-mbedtls:
if: needs.get-mbedtls-version.outputs.currentMbedtlsVersion != needs.get-mbedtls-version.outputs.latestMbedtlsVersion
needs: [ get-mbedtls-version ]
uses: ./.github/workflows/compile-mbedtls.yml
with:
mbedtlsVersion: ${{ needs.get-mbedtls-version.outputs.latestMbedtlsVersion }}
create-pr:
name: Create a PR with new mbedtls binaries
needs: [ get-mbedtls-version, compile-mbedtls ]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Cleanup old mbedtls binaries
run: |
rm -rf mbedtls-lib/bin
- uses: actions/download-artifact@v4
with:
name: linux-x86-64
path: mbedtls-lib/bin/linux-x86-64/
- uses: actions/download-artifact@v4
with:
name: darwin
path: mbedtls-lib/bin/darwin/
- uses: actions/download-artifact@v4
with:
name: win32-x86-64
path: mbedtls-lib/bin/win32-x86-64/
- uses: actions/download-artifact@v4
with:
name: MbedtlsSizeOf.kt
path: kotlin-mbedtls/src/main/kotlin/org/opencoap/ssl/
- name: Bump default compile version
env:
NEW_MBEDTLS_VERSION: ${{ needs.get-mbedtls-version.outputs.latestMbedtlsVersion }}
run: |
sed -i 's/^\(DEFAULT_MBEDTLS_VERSION=\).\+$/\1'${NEW_MBEDTLS_VERSION}'/' compileMbedtls.sh
sed -i 's/^\(mbedtlsVersion=\).\+$/\1'${NEW_MBEDTLS_VERSION}'/' kotlin-mbedtls/src/main/resources/mbedtls.properties
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: update-mbedtls
delete-branch: true
commit-message: Update Mbedtls
title: 🏗️️ Update Mbedtls to ${{ needs.get-mbedtls-version.outputs.latestMbedtlsVersion }}
body: |
Update MbedTLS version to ${{ needs.get-mbedtls-version.outputs.latestMbedtlsVersion }}
----
Auto-generated by [update-mbedtls workflow][1]
[1]: https://github.com/nRFCloud/provisioning/actions/workflows/update-mbedtls.yml