Skip to content

Commit

Permalink
WIP: publish kentik agent package
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Sep 4, 2024
1 parent dc5fe64 commit 8a5dc66
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/actions/bundle/action.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';

let binary = process.env.BINARY;
let version = process.env.VERSION;

let [name, arch, _, os] = binary.split('-');

switch (arch) {
case 'aarch64':
arch = 'arm64';
break;
case 'armv7':
arch = 'arm';
break;
case 'x86_64':
arch = 'amd64';
break;
}

let bundle = `${name}_${version}_${os}_${arch}.tgz`;
let prefix = `${name}-${version}`;

let dir = `${prefix}/bin`;
await io.mkdirP(dir);
await io.cp(binary, `${dir}/${name}`);

await exec.exec(`tar -czvf ${bundle} ${prefix}`);

core.setOutput('bundle', bundle);
38 changes: 38 additions & 0 deletions .github/actions/bundle/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: bundle

inputs:
artifact:
required: true
version:
required: true

outputs:
bundle:
value: ${{ steps.bundle.outputs.bundle }}

runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact }}
- run: ls -lR
shell: bash
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install $GITHUB_ACTION_PATH
shell: bash
- run: node $GITHUB_ACTION_PATH/action.mjs
env:
BINARY: ${{ inputs.artifact }}
VERSION: ${{ inputs.version }}
shell: bash
id: bundle
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.bundle.outputs.bundle }}
path: ${{ steps.bundle.outputs.bundle }}
10 changes: 10 additions & 0 deletions .github/actions/bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "bundle",
"type": "module",
"version": "0.0.1",
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3"
}
}
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ jobs:
name: version
path: version

bundle:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
steps:
- name: generate bundle
uses: ./.github/actions/bundle
with:
artifact: kprobe-${{ matrix.target }}
version: ${{ needs.version.outputs.version }}
id: bundle
needs: [build, version]

package:
runs-on: ubuntu-latest
strategy:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: publish

on:
workflow_dispatch:
push:
branches: publish-kentik-package

jobs:
package:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: generate bundle
# uses: ./.github/actions/bundle
# with:
# binary: kprobe-${{ matrix.target }}
# version: v2.5.0-rc1
# id: bundle
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ steps.bundle.outputs.bundle }}
# path: ${{ steps.bundle.outputs.bundle }}


# publish:
# runs-on: ubuntu-latest
# continue-on-error: true
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# # - uses: actions/create-github-app-token@v1
# # id: token
# # with:
# # app-id: ${{ vars.KENTIK_MACHINERY_APP_ID }}
# # private-key: ${{ secrets.KENTIK_MACHINERY_PRIVATE_KEY }}
# # owner: ${{ github.repository_owner }}

0 comments on commit 8a5dc66

Please sign in to comment.