wip: packaging + scripts before archive into OpenKKnD
This commit is contained in:
parent
820813e24b
commit
769d779571
11 changed files with 177 additions and 7 deletions
40
scripts/bump-and-build.sh
Executable file
40
scripts/bump-and-build.sh
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
# Bump patch version and release-build for this host. Run by LaunchAgent every 4h.
|
||||
set -euo pipefail
|
||||
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
mkdir -p logs dist
|
||||
LOG="$ROOT/logs/build.log"
|
||||
exec >>"$LOG" 2>&1
|
||||
echo "==== $(date -R) bump-and-build start ===="
|
||||
|
||||
ver=$(tr -d "[:space:]" < VERSION)
|
||||
IFS=. read -r maj min pat <<<"$ver"
|
||||
pat=${pat:-0}
|
||||
pat=$((pat + 1))
|
||||
new="${maj}.${min}.${pat}"
|
||||
echo "$new" > VERSION
|
||||
echo "version $ver -> $new"
|
||||
|
||||
rm -rf build
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build -j"$(sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
outdir="$ROOT/dist/$new"
|
||||
mkdir -p "$outdir"
|
||||
cp -f build/openkknd "$outdir/"
|
||||
# record
|
||||
{
|
||||
echo "version=$new"
|
||||
echo "built=$(date -R)"
|
||||
echo "host=$(hostname)"
|
||||
echo "uname=$(uname -a)"
|
||||
file "$outdir/openkknd" 2>/dev/null || true
|
||||
ls -la "$outdir/openkknd"
|
||||
} | tee "$outdir/BUILDINFO.txt"
|
||||
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
git add VERSION
|
||||
git commit -m "build: release $new (autobuild)" || true
|
||||
fi
|
||||
echo "==== $(date -R) done $new ===="
|
||||
33
scripts/install-autobuild-launchd.sh
Executable file
33
scripts/install-autobuild-launchd.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PLIST="$HOME/Library/LaunchAgents/ch.openkknd.autobuild.plist"
|
||||
mkdir -p "$HOME/Library/LaunchAgents"
|
||||
cat > "$PLIST" << PL
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>ch.openkknd.autobuild</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>$ROOT/scripts/bump-and-build.sh</string>
|
||||
</array>
|
||||
<key>StartInterval</key>
|
||||
<integer>14400</integer>
|
||||
<key>RunAtLoad</key>
|
||||
<false/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>$ROOT/logs/launchd.out.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>$ROOT/logs/launchd.err.log</string>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>$ROOT</string>
|
||||
</dict>
|
||||
</plist>
|
||||
PL
|
||||
launchctl bootout "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true
|
||||
launchctl bootstrap "gui/$(id -u)" "$PLIST"
|
||||
launchctl enable "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true
|
||||
echo "Installed $PLIST (every 14400s = 4h)"
|
||||
Loading…
Add table
Add a link
Reference in a new issue