on: workflow_dispatch: push: branches: - main env: NIX_CONFIG: | extra-substituters = https://attic.radiantwavetech.com/radiantwave extra-trusted-public-keys = radiantwave:QADrjpBWJssTZ3KmiZtcWEf4uAm66oOlHmtQI3jkrgA= jobs: build-commercial: runs-on: orion-lxc steps: - name: Checkout run: git clone --depth 1 ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/KioskConfig.git . - name: Guard main branch is on the production channel run: | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh NAME=$(nix eval --impure --raw .#channelName) if [ "$NAME" != "radiantwave" ]; then echo "ERROR: main branch resolves to the '$NAME' channel, expected 'radiantwave'." echo " A dev->main merge brought a dev-pointing channel block into flake.nix." echo " Set channel.appInput/atticRepo/gitRef back to main values before building prod ISOs." exit 1 fi # Fail fast unless the closure baked into the ISO is exactly what # RadiantWave CI published to Attic. Otherwise the kiosk compiles # RadiantWave from source (slow) and the live updater immediately swaps # to the announced closure on first boot. See `channel` in flake.nix. - name: Verify baked baseline matches the published channel run: | set -euo pipefail . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh VERSION=$(nix eval --impure --raw .#channelVersion) ATTIC=$(nix eval --impure --raw .#channelAtticUrl) MANIFEST_URL="$(nix eval --impure --raw .#channelManifestDir)/manifest.json" BASELINE=$(nix eval --impure --raw .#baselineOutPaths.x86_64-linux) MANIFEST=$(curl -fsSL "$MANIFEST_URL") PUB_VERSION=$(MANIFEST="$MANIFEST" nix eval --impure --raw --expr '(builtins.fromJSON (builtins.getEnv "MANIFEST")).version') PUB_PATH=$(MANIFEST="$MANIFEST" nix eval --impure --raw --expr '(builtins.fromJSON (builtins.getEnv "MANIFEST")).storePath') echo "channel version : $VERSION" echo "manifest version: $PUB_VERSION" echo "baseline path : $BASELINE" echo "manifest path : $PUB_PATH" if [ "$VERSION" != "$PUB_VERSION" ]; then echo "ERROR: channel.appVersion '$VERSION' != published manifest version '$PUB_VERSION'." echo " Bump channel.appVersion (and the pinned radiantwave input) to match the release." exit 1 fi if [ "$BASELINE" != "$PUB_PATH" ]; then echo "ERROR: baseline '$BASELINE' is not the published closure '$PUB_PATH'." echo " Run 'nix flake update radiantwave' so the pinned input resolves to the release the manifest was built from." exit 1 fi HASH=$(basename "$BASELINE" | cut -d- -f1) if ! curl -fsS -o /dev/null "$ATTIC/${HASH}.narinfo"; then echo "ERROR: $BASELINE is not in $ATTIC; the ISO would compile RadiantWave from source." exit 1 fi - name: Prepare output directory run: mkdir -p /var/lib/gitea-runner/radiantwave - name: Build commercial kiosk ISO run: | export NIXPKGS_ALLOW_UNFREE=1 . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh nix build -L --impure .#nixosConfigurations.commercial-iso.config.system.build.isoImage - name: Rename commercial kiosk ISO run: | ISO_DATE=$(date +%Y-%m-%d_%H-%M-%S) FILENAME="radiantwave-commercial-iso-${ISO_DATE}.iso" cp -L result/iso/*.iso "/var/lib/gitea-runner/radiantwave/${FILENAME}" echo "COMMERCIAL_ISO_FILENAME=${FILENAME}" >> "$GITHUB_ENV" - name: Copy commercial kiosk ISO to fileserver run: | scp "/var/lib/gitea-runner/radiantwave/${COMMERCIAL_ISO_FILENAME}" \ 157.245.124.103:/mnt/infrastructure_data/files/images/ - name: Cleanup commercial kiosk ISO run: rm -f "/var/lib/gitea-runner/radiantwave/${COMMERCIAL_ISO_FILENAME}"