Build and Release PELF tooling as a single-file executable #102
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 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 | |
permissions: | |
contents: write | |
container: | |
image: "alpine:latest" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Add non-compliant tools, because sucky software requires sucky software | |
run: | | |
apk add git bash file binutils patchelf findutils grep sed coreutils strace | |
apk add go fuse3 fuse curl yq-go | |
- name: Set up GOBIN and install lib4bin | |
run: | | |
set -x | |
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" | |
echo "DBIN_INSTALL_DIR=$DBIN_INSTALL_DIR" >> $GITHUB_ENV | |
echo "DBIN_NOCONFIG=$DBIN_NOCONFIG" >> $GITHUB_ENV | |
echo "GOBIN=$GOBIN" >> $GITHUB_ENV | |
echo "PATH=$PATH" >> $GITHUB_ENV | |
git clone --depth 1 --branch dev https://github.com/xplshn/pelf | |
cp ./pelf/pelf* "$GOBIN" || true | |
cd ./pelf/cmd/misc/appstream_helper | |
go install . | |
cd ../../../standaloneRuntimes/go | |
go build | |
strip ./appbundle-runtime | |
mv ./appbundle-runtime "$GOBIN" | |
cd | |
wget -qO- "https://raw.githubusercontent.com/xplshn/dbin/master/stubdl" | sh -s -- --install "$DBIN_INSTALL_DIR/dbin" -v | |
DBIN_INSTALL_DIR="$GOBIN" "$DBIN_INSTALL_DIR/dbin" --silent add dwarfs/dwarfs dwarfs/mkdwarfs dwarfs/dwarfsextract squashfs-tools/mksquashfs squashfs-tools/unsquashfs squashfs-tools/sqfstar squashfs-tools/sqfscat squashfuse/squashfuse squashfuse/squashfuse_ll unionfs-fuse3/unionfs bwrap yq gh | |
echo "WITH_SHARUN=1" >> $GITHUB_ENV | |
echo "GEN_LIB_PATH=1" >> $GITHUB_ENV | |
echo "ANY_EXECUTABLE=1" >> $GITHUB_ENV | |
echo "_VAR_CUSTOM_RUNTIME=$GOBIN/appbundle-runtime" >> $GITHUB_ENV | |
ls -l "$DBIN_INSTALL_DIR" | |
ROOTFS_URL="$(curl -qsL https://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/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" | |
echo "$ROOTFS_URL" > "$GITHUB_WORKSPACE/.alpine_edge_rootfs.url" | |
set -x | |
ls -l "$DBIN_INSTALL_DIR" | |
mkdir "$GITHUB_WORKSPACE/dist" | |
cd "$GITHUB_WORKSPACE/dist" | |
pelfCreator -m "pkgforge-dev_xplshn" -n "pelf-toolchain" \ | |
-p "bash file binutils patchelf findutils grep sed coreutils strace" \ | |
-x "usr/bin/strip | |
usr/bin/strace | |
usr/bin/grep | |
usr/bin/sed | |
usr/bin/find | |
usr/bin/file | |
usr/bin/objcopy | |
usr/bin/bash | |
usr/bin/diff | |
usr/bin/patch | |
usr/bin/patchelf" \ | |
-e "pelf-dwfs" \ | |
-j "sqfs" \ | |
-z | |
APPDIR="$(echo pelf-toolchain*.AppDir)" | |
ls -l "$DBIN_INSTALL_DIR" | |
cp -a $DBIN_INSTALL_DIR/* "$APPDIR/bin" | |
"$APPDIR/.gen" | |
mv ./pelf-toolchain*.AppBundle ./pelf-toolchain.sqfs.AppBundle | |
- name: Set version | |
run: | | |
head -n 1 version | |
export VERSION="$(head -n 1 version)" | |
echo "APP_VERSION=${VERSION}" >> "${GITHUB_ENV}" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4.6.1 | |
with: | |
name: AppBundle | |
path: dist/*.AppBundle* | |
- name: Upload version file | |
uses: actions/upload-artifact@v4.6.1 | |
with: | |
name: version | |
path: version | |
- name: Delete existing release if it exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release delete "${{ env.APP_VERSION }}" --yes || true | |
- name: Create Release | |
uses: softprops/action-gh-release@v2.2.1 | |
with: | |
name: "${{ env.APP_VERSION }}" | |
tag_name: "${{ env.APP_VERSION }}" | |
prerelease: ${{ env.prerelease }} | |
draft: false | |
generate_release_notes: true | |
make_latest: true | |
files: | | |
${{ github.workspace }}/dist/*.AppBundle* | |
continue-on-error: true |