diff --git a/.github/workflows/release-notifications.yml b/.github/workflows/release-notifications.yml index 5a6a412dc7..104c25163c 100644 --- a/.github/workflows/release-notifications.yml +++ b/.github/workflows/release-notifications.yml @@ -7,6 +7,22 @@ jobs: send-notification: runs-on: ubuntu-latest steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v2.3.5 + with: + fetch-depth: 0 + + - name: Setup Node.js environment + uses: actions/setup-node@v2.4.1 + with: + node-version: "16" + cache: "yarn" + - name: Post to Slack channel id: slack uses: slackapi/slack-github-action@v1.23.0 @@ -19,7 +35,7 @@ jobs: "type": "header", "text": { "type": "plain_text", - "text": "${{ github.event.release.tag_name}} is out!" + "text": "${{ github.event.release.tag_name}} is out! 🚢" } }, { @@ -33,4 +49,16 @@ jobs: } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_RELEASE }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + + - name: Generate Discord Notification + id: notification + run: message=$(node ./scripts/discord-notis.js '${{ github.event.release.tag_name}}' '${{ github.event.release.html_url }}') && echo ::set-output name=message::${message//$'\n'/'%0A'} + + - name: Discord Notification + id: discord-notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: ${{ steps.notification.outputs.message }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb2ab8572d..75df0f9354 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - + - name: Creating .npmrc run: | cat << EOF > "$HOME/.npmrc" @@ -36,11 +36,5 @@ jobs: - name: Create Release Pull Request uses: changesets/action@v1 -# with: -# version: yarn version -# publish: yarn release -# commit: "chore: Release" -# title: "chore: Release" -# createGithubReleases: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/generate-discord-message.js b/scripts/generate-discord-message.js new file mode 100644 index 0000000000..e73675bb1a --- /dev/null +++ b/scripts/generate-discord-message.js @@ -0,0 +1,13 @@ +async function run() { + const releaseName = process.argv.slice(2)[0] + const releaseUrl = process.argv.slice(2)[1] + + const message = ` + Medusa ${releaseName} is out! 🚢 @here + + Check out the changes here: ${releaseUrl}` + + console.log(message) +} + +run()