-
Notifications
You must be signed in to change notification settings - Fork 21
44 lines (44 loc) · 1.8 KB
/
npm-bundle.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
42
43
44
name: Publish Design System to npm
on:
release:
types: [published]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Read .nvmrc file
id: read-nvmrc-file
run: echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Use Node.js
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.read-nvmrc-file.outputs.nvmrc }}"
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: git config --global user.name "${{ github.actor }}"
- run: git config --global user.email "github-action-${{ github.actor }}@users.noreply.github.com"
- run: npm version ${{ github.event.release.tag_name }}
- run: yarn npm-bundle
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Create Slack notification
if: always()
uses: edge/simple-slack-notify@master
with:
channel: '#pat-lib-notifications'
status: ${{ job.status }}
success_text: 'Successfully published release to npm'
failure_text: 'Failed to publish release to npm'
cancelled_text: 'Publish release to npm was cancelled'
fields: |
[{ "title": "Action", "value": "${env.GITHUB_WORKFLOW} - build (${env.GITHUB_RUN_NUMBER})", "short": true },
{ "title": "Repository", "value": "${env.GITHUB_REPOSITORY}", "short": true },
{ "title": "By", "value": "${{ github.actor }}"},
{ "title": "View job", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]