From 1a2c21405c6d588b258832aa7e2a99467497ca85 Mon Sep 17 00:00:00 2001 From: Nikola Ivanov Date: Sat, 9 Dec 2023 03:34:54 +0100 Subject: [PATCH] Integrate Slack notifications for automatic releases --- .github/workflows/npm-publish.yml | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 44bbf5c..22d51f4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,6 +8,8 @@ jobs: publish-npm: runs-on: ubuntu-latest if: github.event.release.target_commitish == 'main' + outputs: + package-version: ${{ steps.get_version.outputs.version }} steps: - name: Check out the repository uses: actions/checkout@v3 @@ -25,3 +27,15 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Get the package version + id: get_version + run: echo "::set-output name=version::$(node -p "require('./package.json').version")" + + - name: Notify Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_TITLE: 'Deployment Status' + SLACK_MESSAGE: 'npm package @webredone/trb-cli version ${{ steps.get_version.outputs.version }} published successfully!' + SLACK_COLOR: '#36a64f' diff --git a/package.json b/package.json index c7d6d16..23b04d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@webredone/trb-cli", - "version": "2.0.1", + "version": "2.0.2", "description": "TRB-CLI is a handy Node.js CLI that automates the process of managing blocks in a Theme Redone WordPress theme", "main": "index.js", "type": "module",