From a62113476fc8f5728422db0a7317fb3cca950fbb Mon Sep 17 00:00:00 2001 From: Vaisakh Murali Date: Sat, 18 Mar 2023 02:02:27 +0600 Subject: [PATCH] CI: Setup telegram notification infra Change-Id: I0030149c20f3524f76cac35d2edd12db0b555096 Signed-off-by: Vaisakh Murali --- .github/workflows/kernel.yml | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 558358a0ae82..618ed50690e6 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -3,9 +3,21 @@ name: Kernel Build CI on: push: +env: + BOT_MSG_URL: ${{ secrets.TG_BOT_MSG_URL }} + CHAT_ID: ${{ secrets.TG_CHAT_ID }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: - build-lemonade-clang: + bot-notify-ci: + runs-on: ubuntu-latest + steps: + - name: Send message + run: curl -s -X POST ${{ env.BOT_MSG_URL }} -d chat_id=${{ env.CHAT_ID }} -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="CI kernel build triggered for OnePlus 9 Series" + + build-lemonade-clang: + needs: [bot-notify-ci] runs-on: ubuntu-latest steps: @@ -40,7 +52,7 @@ jobs: path: ak3/*.zip build-lemonade-gcc: - + needs: [bot-notify-ci] runs-on: ubuntu-latest steps: @@ -68,7 +80,7 @@ jobs: path: ak3/*.zip build-martini-clang: - + needs: [bot-notify-ci] runs-on: ubuntu-latest steps: @@ -103,7 +115,7 @@ jobs: path: ak3/*.zip build-martini-gcc: - + needs: [bot-notify-ci] runs-on: ubuntu-latest steps: @@ -146,5 +158,16 @@ jobs: run: echo "TAG_NAME=$(date -u +%d%m%Y%I%M)" >> $GITHUB_ENV - name: Create Release run: gh release create ${{ env.TAG_NAME }} --generate-notes -p *.zip - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + bot-notify: + needs: [publish-release] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Release Check + run: gh release list -L 1 > list + - name: Prepare release message + run: gh release view $(cat list | awk '{ print substr( $0, 1, length($0)-45 ) }') > release-text + - name: Send message + run: curl -s -X POST ${{ env.BOT_MSG_URL }} -d chat_id=${{ env.CHAT_ID }} -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="New build %0A$(cat release-text | sed '1d;3d;4d;6d;7d;9d;10d;11d;12d;')"