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 f2fe513
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 2 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);
28 changes: 28 additions & 0 deletions .github/actions/bundle/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: bundle

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

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

runs:
using: composite
steps:
- 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
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"
}
}
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,24 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: kprobe-${{ matrix.target.name }}
- id: package
uses: kentik/pkg@master
- name: generate bundle
uses: ./.github/actions/bundle
with:
artifact: kprobe-${{ matrix.target }}
version: ${{ needs.version.outputs.version }}
id: bundle
- uses: kentik/pkg@master
with:
name: ${{ github.event.repository.name }}
version: ${{ needs.version.outputs.version }}
arch: ${{ matrix.target.arch }}
format: ${{ matrix.format }}
package: package.yml
id: package
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.bundle.outputs.bundle }}
path: ${{ steps.bundle.outputs.bundle }}
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.package }}
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 f2fe513

Please sign in to comment.