Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CD

on:
workflow_dispatch:
inputs:
publish:
description: "Publish artifacts from electron-builder"
required: true
default: "never"
type: choice
options:
- never
- always
linux_setup_id:
description: "Config setup ID used to source Linux engine resource"
required: true
default: "latest-linux"
type: string
windows_setup_id:
description: "Config setup ID used to source Windows engine resource"
required: true
default: "latest-win"
type: string

defaults:
run:
shell: bash

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
build_cmd: "build-linux"
arch: "--x64"
platform: "linux"

- os: windows-latest
build_cmd: "build-win"
arch: "--x64"
platform: "win32"

steps:
- uses: actions/checkout@v6
with:
# This should fix git rev-list --count HEAD
# https://stackoverflow.com/a/65056108
fetch-depth: 0
submodules: recursive
path: repo-folder

- uses: actions/checkout@v6
with:
repository: gajop/spring-launcher
submodules: recursive
path: spring-launcher

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"

- name: Prepare folder structure
run: |
mkdir build
cp spring-launcher/* -r build/
cp repo-folder/dist_cfg/* -r build/src/
mkdir -p build/{bin,files,build}
[ -d build/src/bin/ ] && mv build/src/bin/* build/bin/
[ -d build/src/files/ ] && mv build/src/files/* build/files/
[ -d build/src/build/ ] && mv build/src/build/* build/build/
rm -rf build/src/{bin,files,build}

tree -a -L 3 build

- name: Prepare packaged assets
run: |
GIT_HASH=$(git -C repo-folder rev-parse --short=12 HEAD)
PACKAGE_VERSION=1.$(git -C repo-folder rev-list --count HEAD).0

uv run --project ./repo-folder/build --locked sbc-packager-package \
--repo-root ./repo-folder \
--config-in ./repo-folder/dist_cfg/config.json \
--config-out ./build/src/config.json \
--files-dir ./build/files \
--meta-out ./build/build/package-assets.json \
--package-json ./build/package.json \
--repo-full-name Spring-SpringBoard/SpringBoard-Core \
--platform "${{ matrix.platform }}" \
--git-hash "$GIT_HASH" \
--package-version "$PACKAGE_VERSION" \
--linux-setup-id "${{ github.event.inputs.linux_setup_id }}" \
--windows-setup-id "${{ github.event.inputs.windows_setup_id }}"

cat build/package.json

- name: Build
run: |
cd build
npm install
npm run ${{ matrix.build_cmd }} -- ${{ matrix.arch }} --publish "${{ github.event.inputs.publish }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: springboard-${{ matrix.platform }}-bundle
path: build/dist/**
if-no-files-found: error
78 changes: 0 additions & 78 deletions .github/workflows/launcher.yml

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
submodules: 'true'
submodules: true


- name: Install luacheck
run: |
pip install hererocks
hererocks env --lua 5.1 -rlatest
python3 -m pip install hererocks
python3 -m hererocks env --lua 5.1 --no-readline -rlatest
source env/bin/activate
luarocks install luacheck

- name: Run luacheck
run: |
source env/bin/activate
luacheck scen_edit triggers libs_sb/utils libs_sb/savetable.lua --enable 1

33 changes: 33 additions & 0 deletions .github/workflows/packager-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Packager CI

on:
push:
paths:
- "build/**"
- ".github/workflows/packager-ci.yaml"
pull_request:
paths:
- "build/**"
- ".github/workflows/packager-ci.yaml"
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"

- name: Ruff
run: uv run --project ./build --locked ruff check ./build/sbc_packager

- name: Pyright
run: uv run --project ./build --locked pyright ./build/sbc_packager
79 changes: 79 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# SBC Packager

This folder contains the Python packager used by CD to produce a fully standalone SpringBoard build.

## Tooling

- Python: `3.13`
- Runner: `uv`
- CLI: `typer`
- Validation: `pydantic`
- Lint/typecheck: `ruff`, `pyright`

## Main command

Use `sbc-packager-package` to run the full packager pipeline:

1. Rewrite packaged config and game files (`prepare`)
2. Download and extract the platform engine (`download-engine`)
3. Generate Electron `package.json` (`make-package-json`)

The command requires explicit git-derived values from the caller:

- `--git-hash`
- `--package-version`

This keeps packager behavior deterministic and avoids hidden git subprocess logic inside the package tool.

## Local usage

From repository root:

```bash
git clone --depth 1 https://github.com/gajop/spring-launcher.git /tmp/spring-launcher

mkdir -p /tmp/sbc-local-build
cp -r /tmp/spring-launcher/* /tmp/sbc-local-build/
cp -r ./dist_cfg/* /tmp/sbc-local-build/src/
mkdir -p /tmp/sbc-local-build/{bin,files,build}
[ -d /tmp/sbc-local-build/src/bin/ ] && mv /tmp/sbc-local-build/src/bin/* /tmp/sbc-local-build/bin/
[ -d /tmp/sbc-local-build/src/files/ ] && mv /tmp/sbc-local-build/src/files/* /tmp/sbc-local-build/files/
[ -d /tmp/sbc-local-build/src/build/ ] && mv /tmp/sbc-local-build/src/build/* /tmp/sbc-local-build/build/
rm -rf /tmp/sbc-local-build/src/{bin,files,build}

GIT_HASH=$(git rev-parse --short=12 HEAD)
PACKAGE_VERSION=1.$(git rev-list --count HEAD).0

uv run --project ./build --locked sbc-packager-package \
--repo-root . \
--config-in ./dist_cfg/config.json \
--config-out /tmp/sbc-local-build/src/config.json \
--files-dir /tmp/sbc-local-build/files \
--meta-out /tmp/sbc-local-build/build/package-assets.json \
--package-json /tmp/sbc-local-build/package.json \
--repo-full-name Spring-SpringBoard/SpringBoard-Core \
--platform linux \
--git-hash "$GIT_HASH" \
--package-version "$PACKAGE_VERSION" \
--linux-setup-id latest-linux \
--windows-setup-id latest-win
```

`/tmp/sbc-local-build` must be a launcher build tree (same structure as CD creates in `./build` job workspace).

## Linting

```bash
uv run --project ./build --locked ruff check ./build/sbc_packager
uv run --project ./build --locked pyright ./build/sbc_packager
```

## Linux AppImage sandbox note

`make-package-json` injects `afterPack: build/sbc_after_pack.cjs`.
That hook rewrites the Linux launcher binary to ensure direct `AppImage` execution uses:

- `--no-sandbox`
- `--disable-setuid-sandbox`

without requiring users to pass flags manually.
39 changes: 0 additions & 39 deletions build/make_package_json.js

This file was deleted.

Loading