-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (185 loc) · 6.42 KB
/
release.yml
File metadata and controls
214 lines (185 loc) · 6.42 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
207
208
209
210
211
212
213
214
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
checks: read
env:
DOTNET_VERSION: '10.0.x'
PROJECT: src/kapacitor/kapacitor.csproj
jobs:
ci:
name: Wait for CI
runs-on: ubuntu-latest
steps:
- name: Wait for CI workflow to succeed
uses: lewagon/wait-on-check-action@v1.6.1
with:
ref: ${{ github.sha }}
check-regexp: '^(Build and test|AOT publish check)$'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 15
checks-discovery-timeout: 300
build:
needs: ci
strategy:
fail-fast: false
matrix:
include:
- rid: osx-arm64
os: macos-latest
npm-package: kapacitor-darwin-arm64
binary-name: kapacitor
- rid: linux-x64
os: ubuntu-latest
npm-package: kapacitor-linux-x64
binary-name: kapacitor
- rid: linux-arm64
os: ubuntu-24.04-arm
npm-package: kapacitor-linux-arm64
binary-name: kapacitor
- rid: linux-musl-x64
os: ubuntu-latest
container: alpine:3.20
npm-package: kapacitor-linux-musl-x64
binary-name: kapacitor
- rid: linux-musl-arm64
os: ubuntu-24.04-arm
npm-package: kapacitor-linux-musl-arm64
binary-name: kapacitor
- rid: win-x64
os: windows-latest
npm-package: kapacitor-win-x64
binary-name: kapacitor.exe
runs-on: ${{ matrix.os }}
container: ${{ matrix.container || '' }}
steps:
- name: Install Alpine build dependencies
if: matrix.container != ''
shell: sh
run: |
apk add --no-cache bash curl git icu-libs krb5-libs libgcc libstdc++ zlib clang build-base zlib-dev linux-headers
- name: Install Linux build dependencies
if: runner.os == 'Linux' && !matrix.container
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev ${{ contains(matrix.rid, 'musl') && 'musl-tools' || '' }}
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Extract version from tag
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Publish AOT binary
run: >
dotnet publish ${{ env.PROJECT }}
-c Release
-r ${{ matrix.rid }}
-p:MinVerVersionOverride=${{ steps.version.outputs.VERSION }}
-o publish/
- name: Copy binary to npm package
shell: bash
run: |
mkdir -p npm/${{ matrix.npm-package }}/bin
cp publish/${{ matrix.binary-name }} npm/${{ matrix.npm-package }}/bin/
if [ -f publish/libpty_shim.dylib ]; then
cp publish/libpty_shim.dylib npm/${{ matrix.npm-package }}/bin/
fi
- name: Create release archive
shell: bash
run: |
cd publish
if [ "${{ matrix.rid }}" = "win-x64" ]; then
7z a ../kapacitor-${{ matrix.rid }}.zip ${{ matrix.binary-name }}
else
tar czf ../kapacitor-${{ matrix.rid }}.tar.gz ${{ matrix.binary-name }}
if [ -f libpty_shim.dylib ]; then
tar czf ../kapacitor-${{ matrix.rid }}.tar.gz ${{ matrix.binary-name }} libpty_shim.dylib
fi
fi
- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: npm-${{ matrix.npm-package }}
path: npm/${{ matrix.npm-package }}/
- name: Upload release archive
uses: actions/upload-artifact@v7
with:
name: release-${{ matrix.rid }}
path: kapacitor-${{ matrix.rid }}.*
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Download all npm artifacts
uses: actions/download-artifact@v8
with:
pattern: npm-*
path: npm-artifacts/
- name: Update package versions and publish platform packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=${{ steps.version.outputs.VERSION }}
for dir in npm-artifacts/npm-kapacitor-*/; do
pkg_name=$(basename "$dir" | sed 's/^npm-//')
cp "npm/$pkg_name/package.json" "$dir/package.json"
cd "$dir"
npm version "$VERSION" --no-git-tag-version --allow-same-version
npm publish --access public
cd -
done
- name: Update plugin version
run: |
VERSION=${{ steps.version.outputs.VERSION }}
node -e "
const pkg = require('./kapacitor/.claude-plugin/plugin.json');
pkg.version = '$VERSION';
require('fs').writeFileSync('./kapacitor/.claude-plugin/plugin.json', JSON.stringify(pkg, null, 2) + '\n');
"
- name: Copy plugin into wrapper package
run: cp -r kapacitor/ npm/kapacitor/kapacitor/
- name: Publish wrapper package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=${{ steps.version.outputs.VERSION }}
cd npm/kapacitor
npm version "$VERSION" --no-git-tag-version --allow-same-version
node -e "
const pkg = require('./package.json');
for (const dep of Object.keys(pkg.optionalDependencies || {})) {
pkg.optionalDependencies[dep] = '$VERSION';
}
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
npm publish --access public
github-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all release archives
uses: actions/download-artifact@v8
with:
pattern: release-*
path: release-artifacts/
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-artifacts/*
generate_release_notes: true