generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 71
79 lines (71 loc) · 2.35 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
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: override release tag
required: false
push:
branches: ['main', 'alpha', 'beta', 'rc']
paths:
- ".changeset/**"
- "packages/**"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/setup
- name: Build
run: bun run build --concurrency=1
- name: Publish
id: changesets
uses: changesets/action@v1
if: ${{ github.event.inputs.tag == '' }}
with:
publish: bun release
commit: "ci(changesets): version packages"
setupGitUser: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish ${{ inputs.tag || 'canary' }}
if: steps.changesets.outputs.published != 'true'
run: |
git checkout main
bun version:canary
bun release:canary --tag ${{ inputs.tag || 'canary' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send a discord notification
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
fetch(process.env.DISCORD_WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: `A new release is available 🎉. \n [Read the changelog](https://github.com/kubb-project/kubb/releases)`
}),
})
.then((res) => {
console.log('Sent discord notification', res)
})
.catch((err) => {
console.error('Error sending discord notification', err)
})