-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathblockReleaseIt.ts
123 lines (119 loc) · 2.89 KB
/
blockReleaseIt.ts
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
117
118
119
120
121
122
123
import { createSoloWorkflowFile } from "../../steps/writing/creation/dotGitHub/createSoloWorkflowFile.js";
import { base } from "../base.js";
import { blockCSpell } from "./blockCSpell.js";
import { blockPackageJson } from "./blockPackageJson.js";
export const blockReleaseIt = base.createBlock({
about: {
name: "release-it",
},
produce({ options }) {
return {
addons: [
blockCSpell({
words: ["apexskier"],
}),
blockPackageJson({
properties: {
publishConfig: {
provenance: true,
},
},
}),
],
files: {
".github": {
workflows: {
"post-release.yml": createSoloWorkflowFile({
name: "Post Release",
on: {
release: {
types: ["published"],
},
},
permissions: {
issues: "write",
"pull-requests": "write",
},
steps: [
{ uses: "actions/checkout@v4", with: { "fetch-depth": 0 } },
{
run: `echo "npm_version=$(npm pkg get version | tr -d '"')" >> "$GITHUB_ENV"`,
},
{
uses: "apexskier/github-release-commenter@v1",
with: {
"comment-template": `
:tada: This is included in version {release_link} :tada:
The release is available on:
* [GitHub releases](https://github.com/${options.owner}/${options.repository}/releases/tag/{release_tag})
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/${options.repository}/v/\${{ env.npm_version }})
Cheers! 📦🚀
`,
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
},
},
],
}),
"release.yml": createSoloWorkflowFile({
concurrency: {
group: "${{ github.workflow }}",
},
name: "Release",
on: {
push: {
branches: ["main"],
},
},
permissions: {
contents: "write",
"id-token": "write",
},
steps: [
{
uses: "actions/checkout@v4",
with: {
"fetch-depth": 0,
ref: "main",
},
},
{
uses: "./.github/actions/prepare",
},
{
run: "pnpm build",
},
{
env: {
GITHUB_TOKEN: "${{ secrets.ACCESS_TOKEN }}",
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}",
},
uses: "JoshuaKGoldberg/[email protected]",
},
],
}),
},
},
".release-it.json": JSON.stringify({
git: {
commitMessage: "chore: release v${version}",
requireCommits: true,
},
github: {
autoGenerate: true,
release: true,
releaseName: "v${version}",
},
npm: {
publishArgs: [`--access ${options.access}`, "--provenance"],
},
plugins: {
"@release-it/conventional-changelog": {
infile: "CHANGELOG.md",
preset: "angular",
},
},
}),
},
};
},
});