Skip to content

Build and Release PELF tooling as a single-file executable #41

Build and Release PELF tooling as a single-file executable

Build and Release PELF tooling as a single-file executable #41

Workflow file for this run

name: Build and Release PELF tooling as a single-file executable
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: "0 14 * * 0"
workflow_dispatch:
jobs:
build:
name: Build tooling
runs-on: ubuntu-latest
container:
image: "alpine:edge"
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up GOBIN and install lib4bin
run: |
set -x
apk add zstd git bash file binutils patchelf findutils grep sed strace go fuse3 fuse curl yq-go b3sum
export GOBIN="$GITHUB_WORKSPACE/.local/bin" CGO_ENABLED=0 GO_LDFLAGS='-buildmode=static-pie' GOFLAGS='-ldflags=-static-pie -ldflags=-s -ldflags=-w'
export DBIN_INSTALL_DIR="$GOBIN" DBIN_NOCONFIG=1 PATH="$GOBIN:$PATH"
mkdir -p "$GOBIN"
wget -qO- "https://raw.githubusercontent.com/xplshn/dbin/master/stubdl" | sh -s -- --install "$DBIN_INSTALL_DIR/dbin" -v
"$DBIN_INSTALL_DIR/dbin" --silent add yq upx
echo "PATH=$PATH" >> $GITHUB_ENV
echo "DBIN_INSTALL_DIR=$GOBIN" >> $GITHUB_ENV
echo "WITH_SHARUN=1" >> $GITHUB_ENV
echo "GEN_LIB_PATH=1" >> $GITHUB_ENV
echo "ANY_EXECUTABLE=1" >> $GITHUB_ENV
mkdir "$GITHUB_WORKSPACE/dist"
ROOTFS_URL="$(curl -qsL https://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/latest-releases.yaml | yq '.[0].file')"
echo "https://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/${ROOTFS_URL}" >"$GITHUB_WORKSPACE/dist/alpineLinuxEdge.x86_64.rootfsURL"
ROOTFS_URL="$(curl -qsL https://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/latest-releases.yaml | yq '.[0].file')"
echo "https://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/${ROOTFS_URL}" >"$GITHUB_WORKSPACE/dist/alpineLinuxEdge.aarch64.rootfsURL"
ROOTFS_URL="$(curl -qsL https://dl-cdn.alpinelinux.org/alpine/edge/releases/$(uname -m)/latest-releases.yaml | yq '.[0].file')"
ROOTFS_URL="https://dl-cdn.alpinelinux.org/alpine/edge/releases/$(uname -m)/${ROOTFS_URL}"
export ROOTFS_URL
echo "ROOTFS_URL=$ROOTFS_URL" >> "$GITHUB_ENV"
apk add coreutils
- name: Create AppBundle
run: |
cd "$GITHUB_WORKSPACE"
export CGO_ENABLED=0 GOFLAGS="-ldflags=-static-pie -ldflags=-s -ldflags=-w" GO_LDFLAGS="-buildmode=static-pie -s -w"
./cbuild.sh
B3SUM_CHECKSUM="$(b3sum ./pelf | awk '{print $1}')"
mv ./pelf "$GITHUB_WORKSPACE/dist/pelf_$(uname -m)"
echo "RELEASE_TAG=$(date +%d%m%Y)-$B3SUM_CHECKSUM" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4.6.1
with:
name: AppBundle
path: ${{ github.workspace }}/dist/*
- name: Create Release
uses: softprops/action-gh-release@v2.2.1
with:
name: "Build ${{ env.RELEASE_TAG }}"
tag_name: "${{ env.RELEASE_TAG }}"
prerelease: false
draft: false
generate_release_notes: false
make_latest: true
files: |
${{ github.workspace }}/dist/*