Repository navigation
Expand file tree
/
Copy pathrelease.config.mjs
More file actions
206 lines (173 loc) · 6.62 KB
/
Copy pathrelease.config.mjs
File metadata and controls
206 lines (173 loc) · 6.62 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/**
* semantic-release configuration.
*
* This is a JS config (not YAML) because the installation section is appended
* to the release notes via `writerOpts.footerPartial`, which
* conventional-changelog-writer v9 only accepts as a function. Generating the
* section in the notes (rather than the GitHub plugin's releaseBodyTemplate)
* is what lets `addReleases: bottom` work: that option rewrites the release
* body from the raw notes, so anything not in the notes gets discarded.
*/
const installationSection = (context) => {
const version = context.version;
const gitTag = `v${version}`;
return `
## 📦 Installation
### npm / npx (Recommended)
Most developers already have Node.js - run \`infer\` without installing anything. npx downloads the matching native binary on first use:
\`\`\`bash
npx @inference-gateway/cli@${version} --help
npx @inference-gateway/cli@${version} chat
\`\`\`
Or install it globally:
\`\`\`bash
npm install -g @inference-gateway/cli@${version}
infer --help
\`\`\`
> Not recommended for production - prefer the install script, container image, or Nix flake below.
### Quick Install (Install Script)
Install the latest version using our install script:
\`\`\`bash
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash
\`\`\`
Or install a specific version:
\`\`\`bash
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash -s -- --version ${gitTag}
\`\`\`
Custom installation directory:
\`\`\`bash
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash -s -- --install-dir $HOME/.local/bin
\`\`\`
### Nix Flake
Run directly without installing:
\`\`\`bash
nix run github:inference-gateway/cli/${gitTag}
\`\`\`
Or pin it in a [Flox](https://flox.dev) manifest (\`.flox/env/manifest.toml\`):
\`\`\`toml
[install]
infer.flake = "github:inference-gateway/cli/${gitTag}"
\`\`\`
### Container Image
\`\`\`bash
docker run --rm -it ghcr.io/inference-gateway/cli:${version}
\`\`\`
### Binary Download
Download the appropriate binary for your platform from the release assets, or see the [verification guide](https://github.com/inference-gateway/cli/blob/main/docs/binary-verification.md).
`;
};
export default {
branches: [{ name: 'main' }, { name: 'rc/*', prerelease: 'rc' }],
tagFormat: 'v${version}',
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
releaseRules: [
{ type: 'feat', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'docs', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'test', release: 'patch' },
{ type: 'build', release: 'patch' },
{ type: 'ci', release: 'patch' },
{ type: 'chore', release: 'patch' },
{ type: 'revert', release: 'patch' },
{ breaking: true, release: 'minor' },
],
},
],
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
presetConfig: {
types: [
{ type: 'feat', section: '🚀 Features', hidden: false },
{ type: 'fix', section: '🐛 Bug Fixes', hidden: false },
{ type: 'perf', section: '⚡ Performance Improvements', hidden: false },
{ type: 'refactor', section: '♻️ Code Refactoring', hidden: false },
{ type: 'docs', section: '📚 Documentation', hidden: false },
{ type: 'style', section: '💄 Styles', hidden: false },
{ type: 'test', section: '✅ Tests', hidden: false },
{ type: 'build', section: '🔧 Build System', hidden: false },
{ type: 'ci', section: '👷 CI/CD', hidden: false },
{ type: 'chore', section: '🧹 Maintenance', hidden: false },
{ type: 'revert', section: '⏪ Reverts', hidden: false },
],
},
writerOpts: {
commitsSort: ['subject', 'scope'],
footerPartial: installationSection,
},
},
],
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md',
changelogTitle: [
'# Changelog',
'',
'All notable changes to this project will be documented in this file.',
'',
'The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),',
'and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).',
].join('\n'),
},
],
[
'@semantic-release/exec',
{
verifyReleaseCmd: [
'if [ -n "$GITHUB_OUTPUT" ]; then',
' {',
' echo "version=${nextRelease.version}"',
' echo "published=true"',
' } >> "$GITHUB_OUTPUT"',
'fi',
].join('\n'),
prepareCmd: [
`sed -i.bak 's|version = "[^"]*";|version = "\${nextRelease.version}";|' flake.nix && rm flake.nix.bak`,
`sed -i.bak 's|vendorHash = "[^"]*";|vendorHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";|' flake.nix && rm flake.nix.bak`,
`NEW_HASH=$(nix build .#infer 2>&1 | awk '/got:/ {print $2; exit}')`,
`if [ -z "$NEW_HASH" ]; then echo "ERROR: could not extract vendorHash from nix build output"; exit 1; fi`,
`sed -i.bak "s|vendorHash = \\"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\\";|vendorHash = \\"$NEW_HASH\\";|" flake.nix && rm flake.nix.bak`,
`echo "Updated vendorHash to $NEW_HASH"`,
`cp LICENSE npm/LICENSE`,
`cp README.md npm/README.md`,
].join('\n'),
},
],
['@semantic-release/npm', { pkgRoot: 'npm' }],
[
'@semantic-release/git',
{
assets: ['CHANGELOG.md', 'flake.nix', 'npm/package.json'],
message: 'chore(release): ${nextRelease.version} [skip ci]',
},
],
[
'@semantic-release/github',
{
releaseNameTemplate: '🚀 Version <%= nextRelease.version %>',
assets: [
{ path: 'dist/infer-linux-amd64' },
{ path: 'dist/infer-linux-arm64' },
{ path: 'dist/infer-darwin-amd64' },
{ path: 'dist/infer-darwin-arm64' },
{ path: 'dist/infer-windows-amd64' },
{ path: 'dist/infer-windows-arm64' },
{ path: 'dist/checksums.txt' },
{ path: 'dist/checksums.txt.sigstore.json' },
],
discussionCategoryName: false,
addReleases: 'bottom',
releasedLabels: ["<%= nextRelease.channel ? 'prerelease' : 'released' %>"],
},
],
],
};