Merge pull request #118 from k1LoW/tagpr-from-v0.23.8 #35
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: tagpr | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tagpr: | |
runs-on: ubuntu-latest | |
outputs: | |
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }} | |
go-version: ${{ steps.setup-go.outputs.go-version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
id: setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- name: Run tagpr | |
id: run-tagpr | |
uses: Songmu/tagpr@v1 | |
ubuntu-amd64: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
name: Build packages on Ubuntu amd64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
uname -a | |
apt-get -qq update | |
apt-get install -qq gcc g++ make debhelper dh-make clang git curl devscripts fakeroot byacc bison flex libpcap-dev | |
git config --global --add safe.directory $WORKSPACE | |
export LIBPCAP_FILE=libpcap-$LIBPCAP_VERSION.tar.gz | |
export LIBPCAP_URL=https://www.tcpdump.org/release/$LIBPCAP_FILE | |
export GO_FILE=go$GO_VERSION.linux-amd64.tar.gz | |
export GO_URL=https://storage.googleapis.com/golang/$GO_FILE | |
export GOPATH=/go | |
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH | |
curl -OL $GO_URL | |
tar -C /usr/local -xzf $GO_FILE | |
rm $GO_FILE | |
curl -OL $LIBPCAP_URL | |
tar -C /usr/local/src -xzf $LIBPCAP_FILE | |
rm $LIBPCAP_FILE | |
mkdir -p $GOPATH/src $GOPATH/bin | |
chmod -R 777 $GOPATH | |
go version | |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list | |
apt-get -qq update | |
apt-get install -qq goreleaser | |
goreleaser -v | |
goreleaser release --config .goreleaser/deb_amd64.yml --clean --skip=publish | |
image: ubuntu:latest | |
platform: linux/amd64 | |
args: '--env LIBPCAP_VERSION --env GO_VERSION' | |
env: | |
GO_VERSION: ${{ needs.tagpr.outputs.go-version }} | |
LIBPCAP_VERSION: 1.10.4 | |
- name: Check dist/ | |
run: ls dist/ | |
- name: Install test | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
apt-get -qq update | |
apt-get install -qq libpcap0.8 | |
dpkg -i dist/tcpdp*.deb | |
tcpdp version | |
image: ubuntu:latest | |
platform: linux/amd64 | |
- name: Upload dist/ | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-deb-amd64 | |
path: | | |
dist/*.deb | |
dist/*.tar.gz | |
dist/checksums* | |
ubuntu-arm64: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
name: Build packages on Ubuntu arm64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
uname -a | |
apt-get -qq update | |
apt-get install -qq gcc g++ make debhelper dh-make clang git curl devscripts fakeroot byacc bison flex libpcap-dev | |
git config --global --add safe.directory $WORKSPACE | |
export LIBPCAP_FILE=libpcap-$LIBPCAP_VERSION.tar.gz | |
export LIBPCAP_URL=https://www.tcpdump.org/release/$LIBPCAP_FILE | |
export GO_FILE=go$GO_VERSION.linux-amd64.tar.gz | |
export GO_URL=https://storage.googleapis.com/golang/$GO_FILE | |
export GOPATH=/go | |
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH | |
curl -OL $GO_URL | |
tar -C /usr/local -xzf $GO_FILE | |
rm $GO_FILE | |
curl -OL $LIBPCAP_URL | |
tar -C /usr/local/src -xzf $LIBPCAP_FILE | |
rm $LIBPCAP_FILE | |
mkdir -p $GOPATH/src $GOPATH/bin | |
chmod -R 777 $GOPATH | |
go version | |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list | |
apt-get -qq update | |
apt-get install -qq goreleaser | |
goreleaser -v | |
goreleaser release --config .goreleaser/deb_arm64.yml --clean --skip=publish | |
image: ubuntu:latest | |
platform: linux/arm64 | |
args: '--env LIBPCAP_VERSION --env GO_VERSION' | |
env: | |
GO_VERSION: ${{ needs.tagpr.outputs.go-version }} | |
LIBPCAP_VERSION: 1.10.4 | |
- name: Check dist/ | |
run: ls dist/ | |
- name: Install test | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
apt-get -qq update | |
apt-get install -qq libpcap0.8 | |
dpkg -i dist/tcpdp*.deb | |
tcpdp version | |
image: ubuntu:latest | |
platform: linux/arm64 | |
- name: Upload dist/ | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-deb-arm64 | |
path: | | |
dist/*.deb | |
dist/*.tar.gz | |
dist/checksums* | |
centos-amd64: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
name: Build packages on CentOS amd64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
uname -a | |
yum install -y epel-release make clang glibc glibc-static gcc byacc flex libpcap-devel | |
yum remove git* | |
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm | |
yum install -y git | |
git config --global --add safe.directory $WORKSPACE | |
export LIBPCAP_FILE=libpcap-$LIBPCAP_VERSION.tar.gz | |
export LIBPCAP_URL=https://www.tcpdump.org/release/$LIBPCAP_FILE | |
export GO_FILE=go$GO_VERSION.linux-amd64.tar.gz | |
export GO_URL=https://storage.googleapis.com/golang/$GO_FILE | |
export GOPATH=/go | |
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH | |
curl -OL $GO_URL | |
tar -C /usr/local -xzf $GO_FILE | |
rm $GO_FILE | |
curl -OL $LIBPCAP_URL | |
tar -C /usr/local/src -xzf $LIBPCAP_FILE | |
rm $LIBPCAP_FILE | |
mkdir -p $GOPATH/src $GOPATH/bin | |
chmod -R 777 $GOPATH | |
go version | |
echo '[goreleaser] | |
name=GoReleaser | |
baseurl=https://repo.goreleaser.com/yum/ | |
enabled=1 | |
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo | |
yum install -y goreleaser | |
goreleaser -v | |
goreleaser release --config .goreleaser/rpm_amd64.yml --clean --skip=publish | |
image: centos:7 | |
platform: linux/amd64 | |
args: '--env LIBPCAP_VERSION --env GO_VERSION' | |
env: | |
GO_VERSION: ${{ needs.tagpr.outputs.go-version }} | |
LIBPCAP_VERSION: 1.10.4 | |
- name: Check dist/ | |
run: ls dist/ | |
- name: Install test | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
yum install -y dist/tcpdp*.rpm | |
tcpdp version | |
image: centos:7 | |
platform: linux/amd64 | |
- name: Upload dist/ | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-rpm-amd64 | |
path: | | |
dist/*.rpm | |
dist/*.tar.gz | |
dist/checksums* | |
centos-arm64: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
name: Build packages on CentOS arm64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
uname -a | |
yum install -y epel-release make clang glibc glibc-static gcc byacc flex libpcap-devel | |
yum remove git* | |
yum -y install epel-release centos-release-scl | |
yum -y groupinstall "Development Tools" | |
yum -y install wget perl-CPAN gettext-devel perl-devel openssl-devel zlib-devel curl curl-devel expat-devel getopt asciidoc xmlto docbook2X devtoolset-10 | |
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi | |
export GIT_VER="v2.44.0" | |
wget https://github.com/git/git/archive/${GIT_VER}.tar.gz | |
tar -xvf ${GIT_VER}.tar.gz | |
rm -f ${GIT_VER}.tar.gz | |
cd git-* | |
scl enable devtoolset-10 'make configure && ./configure --prefix=/usr && make && make install' | |
cd $WORKSPACE | |
rm -rf git-* | |
git config --global --add safe.directory $WORKSPACE | |
export LIBPCAP_FILE=libpcap-$LIBPCAP_VERSION.tar.gz | |
export LIBPCAP_URL=https://www.tcpdump.org/release/$LIBPCAP_FILE | |
export GO_FILE=go$GO_VERSION.linux-arm64.tar.gz | |
export GO_URL=https://storage.googleapis.com/golang/$GO_FILE | |
export GOPATH=/go | |
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH | |
curl -OL $GO_URL | |
tar -C /usr/local -xzf $GO_FILE | |
rm $GO_FILE | |
curl -OL $LIBPCAP_URL | |
tar -C /usr/local/src -xzf $LIBPCAP_FILE | |
rm $LIBPCAP_FILE | |
mkdir -p $GOPATH/src $GOPATH/bin | |
chmod -R 777 $GOPATH | |
go version | |
echo '[goreleaser] | |
name=GoReleaser | |
baseurl=https://repo.goreleaser.com/yum/ | |
enabled=1 | |
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo | |
yum install -y goreleaser | |
goreleaser -v | |
goreleaser release --config .goreleaser/rpm_arm64.yml --clean --skip=publish | |
image: centos:7 | |
platform: linux/arm64 | |
args: '--env LIBPCAP_VERSION --env GO_VERSION' | |
env: | |
GO_VERSION: ${{ needs.tagpr.outputs.go-version }} | |
LIBPCAP_VERSION: 1.10.4 | |
- name: Check dist/ | |
run: ls dist/ | |
- name: Install test | |
uses: k1LoW/run-on-container@v1 | |
with: | |
run: | | |
yum install -y dist/tcpdp*.rpm | |
tcpdp version | |
image: centos:7 | |
platform: linux/arm64 | |
- name: Upload dist/ | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-rpm-rpm64 | |
path: | | |
dist/*.rpm | |
dist/*.tar.gz | |
dist/checksums* | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- tagpr | |
- ubuntu-amd64 | |
- ubuntu-arm64 | |
- centos-amd64 | |
- centos-arm64 | |
steps: | |
- name: Merge Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: merged-artifacts | |
pattern: dist-* | |
delete-merged: true | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: merged-artifacts | |
path: dist/ | |
- name: Check dist/ | |
run: ls dist/ | |
- name: Setup ghr | |
uses: k1LoW/gh-setup@v1 | |
with: | |
repo: tcnksm/ghr | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
bin-match: ghr | |
force: true | |
- name: Release | |
run: | | |
ghr -u k1LoW -r tcpdp -t ${{ secrets.GITHUB_TOKEN }} -replace ${{ needs.tagpr.outputs.tagpr-tag }} dist/ |