Skip to content

Commit 708d79e

Browse files
author
Luke Wilson
committed
Publish workflow - slack notifications
1 parent 3cf396f commit 708d79e

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

.github/workflows/publish.yaml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,57 @@
1-
name: Publish package to NPM
1+
name: Publish package to npm
2+
23
on:
3-
workflow_dispatch: { }
44
release:
5-
types: [ created ]
5+
types: [created]
6+
67
jobs:
78
build:
89
runs-on: ubuntu-latest
10+
911
permissions:
10-
contents: read
11-
packages: write
12+
contents: write
13+
1214
steps:
13-
- uses: actions/checkout@v3
15+
- name: Checkout repo
16+
uses: actions/checkout@v3
17+
1418
- uses: actions/setup-node@v3
19+
name: Set up node
1520
with:
16-
node-version: '14.x'
17-
registry-url: 'https://registry.npmjs.org'
18-
always-auth: true
19-
- run: yarn
20-
- run: yarn build && yarn publish
21+
node-version: '18.x'
22+
registry-url: 'https://registry.npmjs.org' # set up .npmrc file to publish to npm
23+
24+
- name: Install dependencies
25+
run: yarn install
26+
27+
- name: Build
28+
run: yarn build
29+
30+
- name: Publish
31+
run: yarn publish
2132
env:
2233
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
35+
- name: Notify on success
36+
if: success()
37+
uses: slackapi/[email protected]
38+
env:
39+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
40+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
41+
with:
42+
payload: |
43+
{
44+
"text": ":ship: A new version of <https://www.npmjs.com/package/@terran-one/cosmwasm-vm-js|cosmwasm-vm-js> has been published."
45+
}
46+
47+
- name: Notify on failure
48+
if: failure()
49+
uses: slackapi/[email protected]
50+
env:
51+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
52+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
53+
with:
54+
payload: |
55+
{
56+
"text": ":boom: Failed to publish <https://github.com/Terran-One/cosmwasm-vm-js/actions/workflows/publish.yaml|cosmwasm-vm-js>."
57+
}

0 commit comments

Comments
 (0)