Skip to content

fix/semantic release rules - #42

Closed
erikarenhill wants to merge 3 commits into
srcfl:masterfrom
erikarenhill:fix/semantic-release-rules
Closed

erikarenhill wants to merge 3 commits into
srcfl:masterfrom
erikarenhill:fix/semantic-release-rules

Conversation

@erikarenhill

Copy link
Copy Markdown
Collaborator

No description provided.

Adds a single GitHub Actions workflow (.github/workflows/release.yml)
that runs on every push to master with two jobs:

1. release: cycjimmy/semantic-release-action@v4 walks the conventional
   commits since the last tag, decides the next semver, generates the
   changelog, and pushes the tag + release notes to GitHub. Plugins
   (commit-analyzer, release-notes-generator, changelog, git, github)
   are listed in .releaserc.json so the action picks them up without
   a package.json in the repo.

2. docker: gated on `needs.release.outputs.new_release_published ==
   'true'` so we only push an image when there's actually a new
   version. Uses docker/metadata-action to derive tags
   (ghcr.io/<repo>:vX.Y.Z, :X.Y.Z, :latest, :sha-<short>) and
   docker/build-push-action to build linux/amd64 + linux/arm64 with
   the GHA cache backend.

Replaces the legacy Rust-era Dockerfile with a Go multi-stage build:

  - builder stage: golang:1.25-alpine, BUILDPLATFORM-pinned so the
    toolchain runs natively and only `go build` is cross-compiled.
    CGO_ENABLED=0 -> fully static binary, ldflags -s -w + -trimpath
    for size and reproducibility, VERSION baked in via -X main.Version.
  - runtime stage: alpine:3.20 + ca-certificates + tzdata only.
    Non-root ftw user (uid 100), bundled drivers + web ship verbatim.
  - WORKDIR /app/data so any relative path in the user's config
    (state.path: state.db, state.cold_dir: cold) resolves under the
    persistent /app/data volume by default. Without this the binary
    would default-write state.db to its CWD and lose every byte on
    container recreate. main.go:72 calls state.Open(cfg.State.Path)
    verbatim — there is no resolution against the config file's
    directory, so the WORKDIR is the only knob that matters.
  - VOLUME /app/data — single bind-mount or named volume holds
    config.yaml, state.db (+ -shm/-wal), cold/ parquet rolloff, and
    any future model checkpoints.
  - Smoke-tested locally: 76 MB final image, container starts
    cleanly, state.db lands in /app/data and survives restart.

Bind-mount UID note documented inline: the ftw user is uid 100, so
host bind-mounts must be chowned to 100:101 before container start
(named volumes inherit ownership from the image and need no setup).

Also rewrites .dockerignore as a whitelist so only Dockerfile + go/ +
drivers/ + web/ enter the build context — keeps cold/ parquet, local
state.db, .git, and any future secrets out of the cache.

Permissions on the workflow grant `contents: write` (semantic-release
tags + commits the changelog), `packages: write` (GHCR push), plus
issues + PR write so semantic-release can comment on released PRs.
The default GITHUB_TOKEN handles both GHCR and the tag push.

Note: targets `master` (current default branch on this fork). If the
default is renamed to `main`, update both `.releaserc.json` branches
and the workflow `on.push.branches`.
ci: add semantic-release + multi-arch Docker image to GHCR
The angular preset (default) is too strict for this project's commit
history. It only recognizes a small allow-list of types — feat, fix,
perf, docs, style, chore, refactor, test, build, ci — and it requires
them to be lowercase. Of those, only feat / fix / perf trigger a
release. Every commit since v2.0.0 uses one of:

  drivers, Drivers, Driver, UI, mpc, control, telemetry, support,
  Docs, TSDB, Safety, ci, docs, ...

so semantic-release walked all of them, found nothing releasable, and
exited cleanly with new_release_published=false. The docker job
correctly skipped because of the gating condition. This surfaced as
"release ran but docker was skipped".

Switch the analyzer and notes generator to the conventionalcommits
preset and add custom releaseRules that map this project's existing
prefixes to release types:

  - feat / drivers / driver / ui / support → minor (new behavior /
    surface area worth bumping for)
  - fix / perf / revert / refactor / control / mpc / telemetry / tsdb
    / safety → patch (stability / runtime fixes)
  - docs / test / style / chore / build / ci → no release (unchanged)
  - any commit with BREAKING CHANGE: footer or `!` after the type →
    major (unchanged)

The release notes generator gets a matching preset config so the
custom types render under sensible section headers in the changelog
and GitHub release body.

The workflow's extra_plugins now installs
conventional-changelog-conventionalcommits@8 — semantic-release's
analyzer + notes generator look it up by name at runtime, so it has
to be in node_modules even though we never import it directly.

Note for re-running: this commit itself is fix(ci) which IS release-
triggering under the new rules. So merging this should publish the
first version (v2.0.1, since the latest existing tag is v2.0.0) and
gate-open the docker build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant