From f333deae9f8eca38ae1c7b0b287c85e41bff55b9 Mon Sep 17 00:00:00 2001 From: neil Date: Thu, 22 Dec 2022 09:15:59 +0800 Subject: [PATCH] #99 test notification --- .github/notify-slack.js | 27 +++++++++++++++++++++++++++ .github/workflows/main.yml | 7 +++---- modules/gui/src-tauri/Cargo.toml | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100755 .github/notify-slack.js diff --git a/.github/notify-slack.js b/.github/notify-slack.js new file mode 100755 index 0000000..eceedff --- /dev/null +++ b/.github/notify-slack.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node + +async function main() { + + const message = { + blocks: [ + { + type: 'section', + text: { + type: 'mrkdwn', + text: `NEW BUILD FOR ${process.env.PLATFORM} <${process.env.DOWNLOAD_URL}|download>` + } + } + ] + } + const res = fetch(process.env.SLACK_WEBHOOK, { + method: 'POST', + body: JSON.stringify(message), + headers: { 'Content-Type': 'application/json' } + }) + if (res.ok) { + const data = await res.json(); + console.log(data); + } +} + +main(); \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8be0da4..0ff1fd2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -127,9 +127,8 @@ jobs: aws s3 cp ./modules/gui/src-tauri/target/release/bundle/deb/tea_0.1.0_amd64.deb \ s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}.deb - name: Slack Notification - uses: rtCamp/action-slack-notify@v2 + run: ./.github/notify-slack.js env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_USERNAME: GH_GUI_BOT - SLACK_TITLE: LATEST BUILD {{matrix.platform}} - SLACK_MESSAGE: download + PLATFORM: ${{ matrix.platform }} + DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_${{ steps.date.outputs.unix_seconds }}.${{ matrix.platform == 'ubuntu-latest' && 'deb' || 'dmg'}} diff --git a/modules/gui/src-tauri/Cargo.toml b/modules/gui/src-tauri/Cargo.toml index 97b865c..6576123 100644 --- a/modules/gui/src-tauri/Cargo.toml +++ b/modules/gui/src-tauri/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "app" version = "0.1.0" -description = "A tea.xyz desktop app to complete the cli" +description = "A tea.xyz desktop app" authors = ["you"] license = "" repository = ""