Base ghcr.io/inti-cmnb/kicad10_auto_full:1.9.1-1_k10.0.5 (KiBot 1.9.1, KiCad 10.0.5) plus Node.js 24.22.0 LTS from nodejs.org (SHA-256 checked). act_runner runs JavaScript actions inside the job container; the KiBot images have no Node. build.sh builds, tests and pushes git.b4l.co.th/b4l/kicad10_auto_node:latest and a versioned tag.
36 lines
1.4 KiB
Bash
36 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Build, test and (with --push) publish kicad10_auto_node.
|
|
# ./build.sh build and test
|
|
# ./build.sh --push also push :latest and the versioned tag
|
|
# Newer base or Node: BASE=ghcr.io/inti-cmnb/kicad10_auto_full:<tag> NODE_VERSION=<x.y.z> ./build.sh --push
|
|
# Needs `docker login git.b4l.co.th` (a token with write:package) for --push.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
BASE=${BASE:-ghcr.io/inti-cmnb/kicad10_auto_full:1.9.1-1_k10.0.5_d13.2_b4.2.4LTS}
|
|
NODE_VERSION=${NODE_VERSION:-24.22.0}
|
|
REPO=${REPO:-git.b4l.co.th/b4l/kicad10_auto_node}
|
|
# KiBot 1.9.1-1, KiCad 10.0.5 -> 1.9.1-1_k10.0.5_node24.22.0
|
|
basetag=${BASE##*:}
|
|
TAG="$(printf '%s' "$basetag" | sed -E 's/^([^_]+_k[^_]+).*/\1/')_node${NODE_VERSION}"
|
|
|
|
docker build --pull \
|
|
--build-arg BASE="$BASE" --build-arg NODE_VERSION="$NODE_VERSION" \
|
|
--build-arg NPM_GLOBAL="${NPM_GLOBAL:-}" \
|
|
-t "$REPO:$TAG" -t "$REPO:latest" kicad10_auto_node
|
|
|
|
echo "== test $REPO:$TAG"
|
|
docker run --rm "$REPO:$TAG" bash -ec '
|
|
test "$(node --version)" = "v'"$NODE_VERSION"'"
|
|
node -e "require(\"https\"); require(\"child_process\"); console.log(\"node\", process.version)"
|
|
npm --version >/dev/null
|
|
kibot --version | head -1
|
|
echo "kicad-cli $(kicad-cli --version)"
|
|
git --version; python3 --version'
|
|
|
|
if [ "${1:-}" = "--push" ]; then
|
|
docker push "$REPO:$TAG"
|
|
docker push "$REPO:latest"
|
|
echo "pushed $REPO:$TAG and :latest"
|
|
fi
|