4 Commits

Author SHA1 Message Date
Dave
2ff294724a Use bundled sqlite to avoid cross-compilation problems 2026-03-13 13:09:14 +00:00
Dave
bdffb44bb7 Skipping compilation of front-end for musl build 2026-03-13 13:04:29 +00:00
Dave
1a232f36af Adding changelog generation 2026-03-13 13:02:25 +00:00
Dave
fb8a8773ea Noting release scripts 2026-03-13 13:02:16 +00:00
4 changed files with 71 additions and 1 deletions

View File

@@ -37,3 +37,6 @@ matrix-sdk = { version = "0.16.0", default-features = false, features = [
pulldown-cmark = { version = "0.13.1", default-features = false, features = [ pulldown-cmark = { version = "0.13.1", default-features = false, features = [
"html", "html",
] } ] }
# Force bundled SQLite so static musl builds don't need a system libsqlite3
libsqlite3-sys = { version = "*", features = ["bundled"] }

View File

@@ -77,6 +77,28 @@ ldd target/x86_64-unknown-linux-musl/release/story-kit
./story-kit ./story-kit
``` ```
## Releasing
Builds both macOS and Linux binaries locally, tags the repo, and publishes a Gitea release with a changelog.
**One-time setup:**
1. Create a Gitea API token at `https://code.crashlabs.io/user/settings/applications` (needs repository read/write)
2. Add it to `.env` (gitignored): `GITEA_TOKEN=your_token`
3. Ensure `cross` is installed (`cargo install cross`) and Docker is running
**To release:**
```bash
make release V=0.2.0
```
This will:
- Build macOS arm64 (native) and Linux amd64 (static musl via cross/Docker)
- Generate a changelog from commits since the last tag
- Tag the repo as `v0.2.0` and push the tag
- Create a Gitea release with both binaries and the changelog attached
## Testing ## Testing
### Frontend Tests ### Frontend Tests

View File

@@ -67,6 +67,29 @@ chmod +x "${DIST}"/*
echo "==> Binaries:" echo "==> Binaries:"
ls -lh "${DIST}"/ ls -lh "${DIST}"/
# ── Changelog ──────────────────────────────────────────────────
echo "==> Generating changelog..."
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
CHANGELOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s" --no-merges)
RANGE="${PREV_TAG}...${TAG}"
else
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges)
RANGE="initial...${TAG}"
fi
if [ -z "$CHANGELOG" ]; then
CHANGELOG="- No changes since last release"
fi
RELEASE_BODY="## What's Changed
${CHANGELOG}
**Full diff:** ${GITEA_URL}/${REPO}/compare/${RANGE}"
echo "$RELEASE_BODY"
# ── Tag & Push ───────────────────────────────────────────────── # ── Tag & Push ─────────────────────────────────────────────────
echo "==> Tagging ${TAG}..." echo "==> Tagging ${TAG}..."
git tag -a "$TAG" -m "Release ${TAG}" git tag -a "$TAG" -m "Release ${TAG}"
@@ -74,11 +97,20 @@ git push origin "$TAG"
# ── Create Gitea Release ────────────────────────────────────── # ── Create Gitea Release ──────────────────────────────────────
echo "==> Creating release on Gitea..." echo "==> Creating release on Gitea..."
RELEASE_JSON=$(python3 -c "
import json, sys
print(json.dumps({
'tag_name': sys.argv[1],
'name': sys.argv[1],
'body': sys.argv[2]
}))
" "$TAG" "$RELEASE_BODY")
RELEASE_RESPONSE=$(curl -sf -X POST \ RELEASE_RESPONSE=$(curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
"${GITEA_URL}/api/v1/repos/${REPO}/releases" \ "${GITEA_URL}/api/v1/repos/${REPO}/releases" \
-d "{\"tag_name\": \"${TAG}\", \"name\": \"${TAG}\", \"body\": \"Release ${TAG}\"}") -d "$RELEASE_JSON")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") RELEASE_ID=$(echo "$RELEASE_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")

View File

@@ -29,6 +29,19 @@ fn main() {
return; return;
} }
// When cross-compiling (e.g. musl via `cross`), the Docker container
// has no Node/pnpm. The release script builds macOS first, so
// frontend/dist/ already exists. Skip the frontend build in that case.
let target = env::var("TARGET").unwrap_or_default();
let host = env::var("HOST").unwrap_or_default();
if target != host {
let dist = Path::new("../frontend/dist");
if !dist.exists() {
panic!("Cross-compiling but frontend/dist/ is missing. Build macOS first.");
}
return;
}
let frontend_dir = Path::new("../frontend"); let frontend_dir = Path::new("../frontend");
// Ensure dependencies are installed and build the frontend bundle. // Ensure dependencies are installed and build the frontend bundle.