From 95f0bae2bda6d7dfb60079e6ae75f197cedf3a5d Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 17 Jul 2020 14:30:46 -0700 Subject: [PATCH 1/5] Added slack integration --- .github/workflows/release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe9f60a5fd..1307abe395 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,4 +67,19 @@ jobs: token: ${{ secrets.HOMEBREW_UTILITY_ACCOUNT }} repository: opticdev/homebrew-optic event-type: version-update - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' \ No newline at end of file + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' + + # Tells slack a release has happened + notify-slack: + runs-on: ubuntu-latest + # needs: release-npm + name: Message Slack that Release has happened + steps: + - uses: actions/setup-node@v2-beta + name: Setup Node (to determine latest version of Optic) + with: + node-version: 12 + - run: echo ::set-env name=MESSAGE::"trulyronak released version $(npm view @useoptic/cli version) Publish Release Notes here" + - name: Send message to Slack API + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} From 67e64a200eed121f506496212f1837adffc4c00c Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 17 Jul 2020 14:32:33 -0700 Subject: [PATCH 2/5] added tester --- .github/workflows/testslack.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/testslack.yml diff --git a/.github/workflows/testslack.yml b/.github/workflows/testslack.yml new file mode 100644 index 0000000000..c00d330898 --- /dev/null +++ b/.github/workflows/testslack.yml @@ -0,0 +1,31 @@ +# Releases the latest version of Optic on NPM/Brew/Debian +# Assumes the version has been updated +# Triggers on all changes to the release branch + +name: Release + +env: + BUCKET_NAME: optic-packages + PACKAGE_NAME: api + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + +on: + push: + branches: + - ronakshah/notify-slack + +jobs: + # Tells slack a release has happened + notify-slack: + runs-on: ubuntu-latest + # needs: release-npm + name: Message Slack that Release has happened + steps: + - uses: actions/setup-node@v2-beta + name: Setup Node (to determine latest version of Optic) + with: + node-version: 12 + - run: echo ::set-env name=MESSAGE::"trulyronak released version $(npm view @useoptic/cli version) Publish Release Notes here" + - name: Send message to Slack API + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} From 93ba2ebfb0add0024d643d6a290bc726b195e885 Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 17 Jul 2020 14:34:51 -0700 Subject: [PATCH 3/5] wording --- .github/workflows/testslack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testslack.yml b/.github/workflows/testslack.yml index c00d330898..0eabd73e65 100644 --- a/.github/workflows/testslack.yml +++ b/.github/workflows/testslack.yml @@ -25,7 +25,7 @@ jobs: name: Setup Node (to determine latest version of Optic) with: node-version: 12 - - run: echo ::set-env name=MESSAGE::"trulyronak released version $(npm view @useoptic/cli version) Publish Release Notes here" + - run: echo ::set-env name=MESSAGE::"${{ github.event.pusher.name }} released version $(npm view @useoptic/cli version) \n Publish Release Notes [here](https://github.com/opticdev/optic/releases)" - name: Send message to Slack API run: | curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} From fe2d3fe92a909f8b7ce146fc5478c24de7483cea Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 17 Jul 2020 14:39:30 -0700 Subject: [PATCH 4/5] formatted link --- .github/workflows/testslack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testslack.yml b/.github/workflows/testslack.yml index 0eabd73e65..982859559a 100644 --- a/.github/workflows/testslack.yml +++ b/.github/workflows/testslack.yml @@ -25,7 +25,7 @@ jobs: name: Setup Node (to determine latest version of Optic) with: node-version: 12 - - run: echo ::set-env name=MESSAGE::"${{ github.event.pusher.name }} released version $(npm view @useoptic/cli version) \n Publish Release Notes [here](https://github.com/opticdev/optic/releases)" + - run: echo ::set-env name=MESSAGE::"${{ github.event.pusher.name }} released version $(npm view @useoptic/cli version) \n Publish Release Notes " - name: Send message to Slack API run: | curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} From d57c92a768d4c3c70b22c6cc1c1fef05b7a44d73 Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 17 Jul 2020 14:41:18 -0700 Subject: [PATCH 5/5] ready for deployment --- .github/workflows/release.yml | 6 +++--- .github/workflows/testslack.yml | 31 ------------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/testslack.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1307abe395..e09e2cd23c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,7 @@ jobs: repository: opticdev/homebrew-optic event-type: version-update client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' - + # Tells slack a release has happened notify-slack: runs-on: ubuntu-latest @@ -79,7 +79,7 @@ jobs: name: Setup Node (to determine latest version of Optic) with: node-version: 12 - - run: echo ::set-env name=MESSAGE::"trulyronak released version $(npm view @useoptic/cli version) Publish Release Notes here" + - run: echo ::set-env name=MESSAGE::"${{ github.event.pusher.name }} released version $(npm view @useoptic/cli version) \n Publish Release Notes " - name: Send message to Slack API run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} + curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/testslack.yml b/.github/workflows/testslack.yml deleted file mode 100644 index 982859559a..0000000000 --- a/.github/workflows/testslack.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Releases the latest version of Optic on NPM/Brew/Debian -# Assumes the version has been updated -# Triggers on all changes to the release branch - -name: Release - -env: - BUCKET_NAME: optic-packages - PACKAGE_NAME: api - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - -on: - push: - branches: - - ronakshah/notify-slack - -jobs: - # Tells slack a release has happened - notify-slack: - runs-on: ubuntu-latest - # needs: release-npm - name: Message Slack that Release has happened - steps: - - uses: actions/setup-node@v2-beta - name: Setup Node (to determine latest version of Optic) - with: - node-version: 12 - - run: echo ::set-env name=MESSAGE::"${{ github.event.pusher.name }} released version $(npm view @useoptic/cli version) \n Publish Release Notes " - - name: Send message to Slack API - run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.MESSAGE }}"}' ${{ secrets.SLACK_WEBHOOK_URL }}