-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (34 loc) · 1.14 KB
/
npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Publish to npm
on:
release:
types: [created]
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
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '14.19.1'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: npm ci
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get the package version
id: get_version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- 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 ${{ env.PACKAGE_VERSION }} published successfully!'
SLACK_COLOR: '#36a64f'