WIP: publish kentik agent package #161
Workflow file for this run
This file contains 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: build | |
on: | |
push: | |
branches: "*" | |
tags: "[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-musl | |
- armv7-unknown-linux-musleabihf | |
- x86_64-unknown-freebsd | |
continue-on-error: ${{ !startsWith(matrix.target, 'x86_64') }} | |
steps: | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.KENTIK_API_RUST_DEPLOY_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: | | |
DOCKER_OPTS="-v $SSH_AUTH_SOCK:/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent" | |
echo DOCKER_OPTS="$DOCKER_OPTS" >> $GITHUB_ENV | |
- uses: docker/build-push-action@v4 | |
with: | |
context: .github/workflows | |
file: .github/workflows/Dockerfile.${{ matrix.target }} | |
tags: local/cross:${{ matrix.target }} | |
push: false | |
env: | |
DOCKER_BUILDKIT: 1 | |
- uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: kprobe-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/kprobe | |
needs: version | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: version | |
run: | | |
git describe --always --tags > version | |
date -u +%Y%m%d%H%M%S >> version | |
case "${{ startsWith(github.ref, 'refs/tags') }}" in | |
true) VERSION=`sed -n 1p version` ;; | |
false) VERSION=`sed -n 2p version` ;; | |
esac | |
echo "::notice ::kprobe version: $VERSION" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: version | |
path: version | |
package: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
format: [deb, rpm] | |
target: | |
- name: aarch64-unknown-linux-musl | |
arch: aarch64 | |
- name: armv7-unknown-linux-musleabihf | |
arch: armv7 | |
- name: x86_64-unknown-linux-musl | |
arch: x86_64 | |
continue-on-error: ${{ !startsWith(matrix.target, 'x86_64') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: kprobe-${{ matrix.target.name }} | |
- id: package | |
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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.package.outputs.package }} | |
path: ${{ steps.package.outputs.package }} | |
needs: [build, version] | |
publish-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: packages | |
- name: publish packages | |
run: | | |
ls -ltR packages | |
gem install package_cloud | |
case "${{ startsWith(github.ref, 'refs/tags') }}" in | |
true) REPO="${{ github.event.repository.name }}" ;; | |
false) REPO="${{ github.event.repository.name }}-dev" ;; | |
esac | |
for deb in packages/*.deb/*.deb; do | |
package_cloud push kentik/$REPO/debian/jessie $deb | |
package_cloud push kentik/$REPO/debian/stretch $deb | |
package_cloud push kentik/$REPO/debian/buster $deb | |
package_cloud push kentik/$REPO/debian/bullseye $deb | |
package_cloud push kentik/$REPO/ubuntu/focal $deb | |
package_cloud push kentik/$REPO/ubuntu/bionic $deb | |
package_cloud push kentik/$REPO/ubuntu/jammy $deb | |
done | |
for rpm in packages/*.rpm/*.rpm; do | |
package_cloud push kentik/$REPO/el/7 $rpm | |
package_cloud push kentik/$REPO/el/8 $rpm | |
package_cloud push kentik/$REPO/el/9 $rpm | |
done | |
env: | |
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | |
needs: [package, version] |