Skip to content

Publish prerelease v1.0.0rc2 by @dae-prow[bot] #23

Publish prerelease v1.0.0rc2 by @dae-prow[bot]

Publish prerelease v1.0.0rc2 by @dae-prow[bot] #23

Workflow file for this run

name: Publish Pre-release
run-name: Publish prerelease ${{ inputs.tag }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
tag:
type: string
required: true
jobs:
build:
strategy:
matrix:
goos: [ linux ]
goarch: [ arm64, 386, riscv64, loong64, mips64, mips64le, mipsle, mips, ppc64, ppc64le, s390x ]
include:
# BEGIN Linux ARM 5 6 7
- goos: linux
goarch: arm
goarm: 7
- goos: linux
goarch: arm
goarm: 6
- goos: linux
goarch: arm
goarm: 5
# END Linux ARM 5 6 7
# BEGIN Linux AMD64 v1 v2 v3
- goos: linux
goarch: amd64
goamd64: v1
- goos: linux
goarch: amd64
goamd64: v2
- goos: linux
goarch: amd64
goamd64: v3
# END Linux AMD64 v1 v2 v3
fail-fast: false
runs-on: ubuntu-22.04
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
GOAMD64: ${{ matrix.goamd64 }}
CGO_ENABLED: 0
steps:
- name: Checkout codebase
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag }}
- name: Get the version
id: get_version
env:
REF: ${{ inputs.tag }}
run: |
version=${REF}
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Show workflow information
id: get_filename
run: |
export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOAMD64\"].friendlyName" -r < install/friendly-filenames.json)
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_OUTPUT
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: |
go.mod
go.sum
go-version: '^1.22'
- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y clang-15 llvm-15
- name: Get project dependencies
run: |
git submodule update --init --recursive
GOMODCACHE="${PWD}"/go-mod go mod download -modcacherw
find ./go-mod/ -maxdepth 1 ! -name "cache" ! -name "go-mod" -exec rm -rf {} \;
sed -i 's/#export GOMODCACHE=$(PWD)\/go-mod/export GOMODCACHE=$(PWD)\/go-mod/' Makefile
- name: Create directory for placing archives & packages temporarily
run: mkdir -p ./bundled/
- name: Create full source archive
if: matrix.goarch == 'arm64'
run: |
zip -9vr ./bundled/dae-full-src.zip . -x .git/\* bundled/\*
tar -I 'xz -9' -cvf ./bundled/dae-full-src.tar.xz --exclude .git --exclude bundled .
- name: Build dae
run: |
export CGO_ENABLED=0
export GOFLAGS="-trimpath -modcacherw"
export OUTPUT=pkgdir/usr/bin/dae
export VERSION=${{ env.VERSION }}
export CLANG=clang-15
export STRIP=llvm-strip-15
make
install -Dm644 ./install/dae.service -t ./pkgdir/usr/lib/systemd/system/
install -Dm640 ./example.dae -t ./pkgdir/etc/dae/
install -d ./pkgdir/usr/share/dae/
curl -L -o ./pkgdir/usr/share/dae/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
curl -L -o ./pkgdir/usr/share/dae/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
install -D pkgdir/usr/share/dae/geo{ip,site}.dat install/{dae.service,empty.dae} example.dae -t ./zip/
install -D pkgdir/usr/bin/dae ./zip/dae-$ASSET_NAME
- name: Smoking test
if: matrix.goarch == 'amd64' && matrix.goamd64 == 'v1'
run: ./pkgdir/usr/bin/dae --version
- name: Create binary archive
run: |
tar -I 'xz -9' -cvf ./bundled/dae-$ASSET_NAME.tar.xz -C pkgdir .
cd zip
zip -9vr ../bundled/dae-$ASSET_NAME.zip .
- name: Build Linux packages
if: ${{ env.GOARM == '7' || env.GOARM == '' }}
run: |
sudo apt install -y libarchive-tools
sudo gem install fpm
case $GOARCH in
'amd64' | 'i386' | 'arm64' | 'arm' | 'riscv64' | 'loong64' | 'ppc64' | 'ppc64le') archlinux_pacman='pacman' ;;
*) echo "Skip unsupported architecture for Arch Linux" ;;
esac
for pkg_mgr in deb rpm $archlinux_pacman; do
case $GOARCH in
'amd64')
if [ $pkg_mgr == 'deb' ]; then
pkg_arch='amd64'
else
pkg_arch='x86_64'
fi ;;
'386')
case $pkg_mgr in
'deb') pkg_arch='i386' ;;
'rpm') pkg_arch='x86' ;;
'pacman') pkg_arch'i486' ;;
esac ;;
'arm64')
if [ $pkg_mgr == 'deb' ]; then
pkg_arch='arm64'
else
pkg_arch='aarch64'
fi ;;
'arm')
case $pkg_mgr in
'deb') pkg_arch='armhf' ;;
'rpm') pkg_arch='armhfp' ;;
'pacman') pkg_arch='armv7h' ;;
esac ;;
'loong64')
if [ $pkg_mgr != 'rpm' ]; then
pkg_arch='loong64'
else
pkg_arch='loongarch64'
fi ;;
'mips64le') pkg_arch='mips64el' ;;
'mipsle') pkg_arch='mipsel' ;;
'ppc64le')
if [ $pkg_mgr == 'deb' ]; then
pkg_arch='ppc64el'
else
pkg_arch='ppc64le'
fi ;;
*) pkg_arch=$GOARCH ;;
esac
fpm -s dir -t $pkg_mgr -a $pkg_arch -v ${VERSION/v/} -n dae \
--url "https://github.com/daeuniverse/dae" \
--description "eBPF-based Linux high-performance transparent proxy solution" \
--maintainer "daeuniverse <[email protected]>" \
--license 'AGPL-3.0' \
--package ./bundled/dae-$ASSET_NAME.$pkg_mgr \
--after-install ./install/package_after_install.sh \
--after-remove ./install/package_after_remove.sh \
--deb-compression xz \
--deb-compression-level 9 \
--rpm-compression xz \
--verbose \
-C pkgdir .
done
if [ $archlinux_pacman == 'pacman' ]; then
mv ./bundled/dae-$ASSET_NAME.pacman ./bundled/dae-$ASSET_NAME.pkg.tar.zst
fi
- name: Create signature
run: |
cd bundled
for FILE in *; do
echo "$(md5sum $FILE)"" md5" >> $FILE.dgst
echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst
echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst
echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst
done
- name: Upload files to Artifacts
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
with:
if-no-files-found: ignore
path: ./bundled/*
upload-release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/[email protected]
with:
path: release/
- name: Prepare files for upload
run: |
echo "Show files are going to upload..."
cd release
ls -lh */*
- name: Upload full source and artifacts to GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
files: release/*/*
prerelease: true