Skip to content

Upload Release

Upload Release #55

Workflow file for this run

on:
release:
types: [edited, created]
name: Upload Release
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
include:
- distro: centos
release: 7
pkg: rpm
pkg_name: el
image: centos:7
- distro: centos
release: 8
pkg: rpm
pkg_name: el
image: centos:8
- distro: ubi9
release: 9
pkg: rpm
pkg_name: el
image: redhat/ubi9:9.2
- distro: ubuntu
release: focal
pkg: deb
pkg_name: ubuntu
image: ubuntu:focal
- distro: ubuntu
release: jammy
pkg: deb
pkg_name: ubuntu
image: ubuntu:jammy
- distro: ubuntu
release: lunar
pkg: deb
pkg_name: ubuntu
image: ubuntu:lunar
- distro: debian
release: bullseye
pkg: deb
pkg_name: debian
image: debian:bullseye
- distro: debian
release: buster
pkg: deb
pkg_name: debian
image: debian:buster
- distro: debian
release: bookworm
pkg: deb
pkg_name: debian
image: debian:bookworm
container:
image: ${{ matrix.image }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set Version
run: |
echo "KENTIK_KTRANSLATE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
echo ${{ github.ref_name }}
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.20.4'
- name: Get Deps
shell: bash
run: |
if [ "${{ matrix.distro }}" = "centos" ]
then
if [ "${{ matrix.release }}" = "7" ]
then
yum install -y centos-release-scl
yum install -y make gcc diffutils libpcap-devel rh-ruby27 rh-ruby27-ruby-devel redhat-rpm-config gcc-c++ rh-ruby27-rubygems
scl enable rh-ruby27 bash
else
dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
yum install -y make gcc diffutils ruby-devel redhat-rpm-config gcc-c++
dnf -y --enablerepo=powertools install libpcap-devel
fi
elif [ "${{ matrix.distro }}" = "ubi9" ]
then
yum install -y make gcc diffutils libpcap-devel ruby-devel gcc-c++ redhat-rpm-config
else
apt-get update
apt-get -y install make libpcap-dev ca-certificates build-essential curl ruby ruby-dev
fi
- name: Run Make
run: |
echo ${{ env.KENTIK_KTRANSLATE_VERSION }}
KENTIK_KTRANSLATE_VERSION=${{ env.KENTIK_KTRANSLATE_VERSION }} make
- name: Run Test
run: make test
- name: Install MM DBs
run: |
MAXMIND_LICENSE_KEY=${{ secrets.MM_DOWNLOAD_KEY }} ./bin/get_mm.sh
- name: Create package
id: package
uses: kentik/pkg@master
with:
name: ktranslate
version: ${{ env.KENTIK_KTRANSLATE_VERSION }}
arch: x86_64
format: ${{ matrix.pkg }}
package: ktranslate-package.yml
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.package.outputs.package }}
asset_name: ${{ steps.package.outputs.package }}--${{ matrix.distro }}-${{ matrix.release }}
asset_content_type: application/binary
- name: Send to packagecloud
shell: bash
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
run: |
if [ "${{ matrix.release }}" = "7" ] # Centos7 is extra hard to work with.
then
export PATH=/opt/rh/rh-ruby27/root/usr/local/bin:/opt/rh/rh-ruby27/root/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
export LD_LIBRARY_PATH=/opt/rh/rh-ruby27/root/usr/local/lib64:/opt/rh/rh-ruby27/root/usr/lib64
ruby -v
gem -v
fi
REPO="${{ github.event.repository.name }}"
if [ "${{ matrix.release }}" = "buster" ] # Also some special casing here for buster
then
gem install rake
fi
gem install package_cloud
package_cloud push kentik/$REPO/${{ matrix.pkg_name }}/${{ matrix.release }} ${{ steps.package.outputs.package }}