Add plugin install/remove command and fix marketplace discovery (#3) #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |