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 452f3ab
Show file tree
Hide file tree
Showing 4 changed files with 114 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);
26 changes: 26 additions & 0 deletions .github/actions/bundle/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: bundle

inputs:
binary:
required: true
version:
required: true

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

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --prefix $GITHUB_ACTION_PATH ci
shell: bash
- run: node $GITHUB_ACTION_PATH/action.mjs
env:
BINARY: ${{ inputs.binary }}
VERSION: ${{ inputs.version }}
shell: bash
id: 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"
}
}
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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
- run: |
touch kprobe-${{ matrix.target }}
- 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 452f3ab

Please sign in to comment.