-
Notifications
You must be signed in to change notification settings - Fork 5
93 lines (90 loc) · 3.46 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Publish bun
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Build library
run: |
bun i
bun run build:lib
- name: Setup npm token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" > dist/ngx-loader-indicator-lib/.npmrc
- name: Publish library
run: bun run publish:lib
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Extract version
id: get_version
run: |
VERSION=$(node -p "require('./dist/ngx-loader-indicator-lib/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
slack_notification:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'deployments'
payload: |
{
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Project: `${{ github.event.repository.name }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Commit/PR URL: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Version: `${{ needs.build.outputs.version || 'TBA' }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Website URL: ${{ secrets.NPM_PACKAGE_URL || 'TBA' }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}