From 14ac7c6a1afb3e95881148196b227eb52e0c661d Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Thu, 23 Nov 2023 15:04:57 +0100 Subject: [PATCH] chore: discord message --- .github/workflows/ci.yaml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b5a541495..db71585cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,10 +71,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG: ${{ inputs.tag }} with: - # This expects you to have a script called release which does a build for your packages and calls changeset publish - publish: bun run release --concurrency=1 -- -tag beta + publish: bun run release - name: Publish ${{ inputs.tag || 'canary' }} continue-on-error: true @@ -84,6 +82,29 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG: canary run: | - bun run release:canary --concurrency=1 -- -tag ${{ inputs.tag || 'canary' }} + bun run release:canary --tag ${{ inputs.tag || 'canary' }} + + - name: Send a discord notification + if: steps.publish.outputs.published == 'true' + uses: actions/github-script@v6 + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + fetch(process.env.DISCORD_WEBHOOK_URL, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + content: `New release available. [Read the changelog](https://github.com/kubb-project/kubb/releases)` + }), + }) + .then((res) => { + console.log('Sent discord notification', res) + }) + .catch((err) => { + console.error('Error sending discord notification', err) + })