-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (104 loc) · 3.44 KB
/
release.yml
File metadata and controls
112 lines (104 loc) · 3.44 KB
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
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout Repo
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: package.json
registry-url: 'https://registry.npmjs.org'
scope: '@baseplate-dev'
- name: Upgrade npm to v11 # Necessary for trusted publishing
run: npm install -g npm@11
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
with:
publish: pnpm release
version: pnpm run version
title: 'chore: Version Packages'
createGithubReleases: false
- name: Create GitHub Release
if: steps.changesets.outputs.published == 'true'
run: node ./scripts/create-github-release.ts
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Format Packages for Slack
if: steps.changesets.outputs.published == 'true'
id: format-packages
run: |
{
echo "FORMATTED_PACKAGES<<EOF"
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq 'map(
{
type: "rich_text_section",
elements: [
{
type: "text",
text: .name,
style: { bold: true }
},
{
type: "text",
text: ": "
},
{
type: "text",
text: .version
}
]
}
)'
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Send a Slack notification if a publish happens
if: steps.changesets.outputs.published == 'true'
uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1
with:
payload: |
{
"text": "New versions of Baseplate packages were just released!",
"blocks": [
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "New versions of Baseplate packages were just released:"
}
]
},
{
"type": "rich_text_list",
"elements": ${{ steps.format-packages.outputs.FORMATTED_PACKAGES}},
"style": "bullet"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK