-
Notifications
You must be signed in to change notification settings - Fork 14
116 lines (116 loc) · 4.59 KB
/
release.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
# Build package and publish a prerelease
prerelease:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Ensure that the README is published with the package
- run: rm -f packages/cli/README.md && cp README.md packages/cli
- run: npm ci
- name: Set version and publish prerelease for 'cli' package
run: |
npm --no-git-tag-version version ${{ github.event.release.tag_name }}-prerelease --workspace packages/cli
npm publish --provenance --workspace packages/cli --tag prerelease
- name: Set version and publish prerelease for 'create-cli' package
run: |
npm --no-git-tag-version version ${{ github.event.release.tag_name }}-prerelease --workspace packages/create-cli
npm publish --provenance --workspace packages/create-cli --tag prerelease
- name: Output prerelease packages versions
run: |
npm pkg get version --workspace packages/cli
npm pkg get version --workspace packages/create-cli
# Slack failure alert
- name: Slack Failure Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: Checkly Github Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cli
SLACK_ICON: https://github.com/checkly.png?size=48
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ':red_circle: NPM prerelease failed'
SLACK_MESSAGE: by ${{ github.actor }}
SLACK_FOOTER: ''
# Slack success alert
- name: Slack Success Notification
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: Checkly Github Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cli
SLACK_ICON: https://github.com/checkly.png?size=48
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ':white_check_mark: NPM prerelease succeeded'
SLACK_MESSAGE: by ${{ github.actor }}
SLACK_FOOTER: ''
# Publish package to NPM
release:
runs-on: ubuntu-latest
environment: production
needs: prerelease
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Ensure that the README is published with the package
- run: rm -f packages/cli/README.md && cp README.md packages/cli
- run: npm ci
- name: Set version and publish 'cli' package
run: |
npm --no-git-tag-version version ${{ github.event.release.tag_name }} --workspace packages/cli
npm publish --provenance --workspace packages/cli
- name: Set version and publish 'create-cli' package
run: |
npm --no-git-tag-version version ${{ github.event.release.tag_name }} --workspace packages/create-cli
npm publish --provenance --workspace packages/create-cli
- name: Output final packages versions
run: |
npm pkg get version --workspace packages/cli
npm pkg get version --workspace packages/create-cli
# Slack failure alert
- name: Slack Failure Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: Checkly Github Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cli
SLACK_ICON: https://github.com/checkly.png?size=48
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ':red_circle: NPM publish failed'
SLACK_MESSAGE: by ${{ github.actor }}
SLACK_FOOTER: ''
# Slack success alert
- name: Slack Success Notification
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: Checkly Github Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cli
SLACK_ICON: https://github.com/checkly.png?size=48
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ':white_check_mark: NPM publish succeeded'
SLACK_MESSAGE: by ${{ github.actor }}
SLACK_FOOTER: ''