Provide dist:app:rpm, dist:app:appimage, and dist:app:linux to build the lean muSRFlow application packages without requiring or producing runtime artifacts. Keep existing dist:rpm/dist:appimage/dist:linux behavior for full application+runtime distributions and document the difference.
30 KiB
Desktop Packaging and Releases
This guide is for maintainers building installers and preparing releases. Installing muSRFlow on a user's computer? Start here:
Application version comes from package.json; the current release candidate
is 1.0.0. Target PCs do not need the developer tools described below.
Build host
Install Node.js/npm and the dependencies from the lock file:
npm ci
Package builds run the Electron tests. The first build needs network access for Electron and electron-builder downloads. Runtime source builds need Docker or Podman; see the runtime build guide.
Gitea runner validation
The first CI step is .gitea/workflows/validate.yml,
called Validate muSRFlow. It is manual-only and uses PSI's
ubuntu-latest-full label. The active Linux runners advertise this label;
the label does not guarantee Docker/Podman access inside a job.
To run it:
- Push the workflow commit to Gitea. Keep the workflow on the default branch so it is discoverable by the manual-run interface.
- Enable repository Actions if needed under Settings -> Actions.
- Open Actions -> Validate muSRFlow -> Run workflow and select the ref to test.
- Inspect Inspect runner and test prerequisites, then the test result.
The workflow checks out this repository, reports OS/resources and build-tool
availability, sets up Node.js 22.23.2, installs the locked dependencies, and
runs npm run test:electron. External actions are pinned to commits and
loaded from explicit GitHub URLs. The runner needs access to Gitea, GitHub,
the Node.js distribution downloads, and the npm registry. No extra repository
secrets or publishing credentials are required for this step.
These are headless regression tests, including simulated runtime/WSL tools, not a real scientific fit or an interactive Windows test. The Electron binary download is skipped. There are no package uploads, runtime builds, automatic push/PR triggers, or cache-service dependencies yet. A missing container engine is reported but does not fail the tests; missing test prerequisites do fail.
Podman smoke test
After Validate muSRFlow passes, run Actions -> Validate Podman builds -> Run workflow. The workflow is .gitea/workflows/podman-smoke.yml.
It uses the same runner label to build a small Alpine image, execute a build
RUN instruction, check read-only input and writable output mounts under the
job workspace, and export/compress the container filesystem. The exported
contents and written output must match the input fixture. This verifies more
than podman info alone, including the mount pattern needed by our builders.
The job needs access to Docker Hub for docker.io/library/alpine:3.22.
It requests no privileged mode, changes no runner configuration, and cleans up
only its uniquely named container, image, and temporary workspace. It does not
publish artifacts or build scientific software. Cleanup runs on ordinary
failures and signals; a forced runner shutdown can still leave temporary data.
A pass does not yet validate the manylinux build image, Quay.io access, compiler dependencies, musrfit repository access, or resources for a full ROOT build. Those checks belong to the next runtime-build stage.
Build the runtime once
Open Actions -> Build runtime -> Run workflow. Keep the default
musrfit_ref at bae5d89d42aa79208062609a7ba3a9dbeaf253e2, or supply another
full 40-character commit SHA deliberately. The workflow fetches that commit
from the public https://gitea.psi.ch/LMU/musrfit.git repository; no sibling
checkout or preinstalled scientific runtime is assumed.
The job tests artifact upload before the expensive build, then compiles ROOT 6.38.00 and musrfit using Podman with four build workers. It resolves the manylinux base-image tag to a digest and records it in the runtime manifest. Allow several hours; the compile step is limited to five hours and the job to six hours. The source revision, clean source state, ROOT version, tool startup, and runtime fingerprints are checked before creating a download bundle.
On success, the run has a musrflow-runtime-linux-x64 artifact containing a
content-addressed directory with runtime-download.json, its matching
.tar.gz, and SHA-256 sidecar. Build diagnostics are uploaded separately as
runtime-build-logs, including on ordinary build failures. The build prints
Runtime run ID for Build and package; record that numeric workflow run ID,
not the job/task number embedded in an exported log filename.
No RPM/AppImage tools are needed in this stage. The archived runtime preserves executable permissions and library symlinks; do not upload its unpacked tree as a replacement. Runtime artifacts are requested for 30 days and diagnostics for 14 days, subject to PSI's storage policy. Keep release copies separately.
Package a selected runtime
Preferred setup: commit an approved registry runtime pin as
packaging/runtime/runtime-source.json (see the migration steps below).
Keep the working PACKAGES_TOKEN Actions secret configured for registry
download/publication. No runtime run ID is needed after the pin is committed.
- After a successful runtime build, open Actions -> Build and package -> Run workflow.
- Leave runtime_run_id empty to use the committed pin, or enter a runtime workflow run ID to override it for a manual build. There is no automatic "latest runtime" selection and no fallback to files from an earlier job.
- The workflow downloads the pinned descriptor and archive from the package registry, verifies both hashes and the recorded runtime identity, and restores the bundle in a job-local directory, then validates the scientific tools before building.
- After tests and packaging succeed, the workflow saves musrflow-linux-packages as a run artifact, then automatically publishes the application and runtime RPM/AppImage files to the repository's Packages tab. There is no second publishing workflow or packaging run ID to enter on the normal path.
This produces the application RPM/AppImage, separate runtime RPM/AppImage,
checksums, runtime download bundle, runtime manifest, and build-source record.
Application packaging populates electron-builder's tool cache before the
runtime packagers use it. Missing output fails the job; collection errors are
not suppressed. --publish never prevents implicit electron-builder release
publishing; the final explicit publisher handles the package registry. Manual
builds do not create a Release page or deploy a site. Publication only starts after
the complete artifact is saved, so a registry failure can be retried without
recompiling (see below).
The same workflow also runs for version-tag pushes, as described below. Registry runtimes are independent of Actions artifact retention. During migration, an empty pin still permits the MUSRFLOW_RUNTIME_RUN_ID repository variable; that legacy artifact path retains its expiry limit. A committed pin takes priority over this variable. A broken/missing pinned package fails rather than silently falling back to a different runtime.
Preserve and approve a durable runtime
- Open Actions -> Publish runtime -> Run workflow and enter the existing
runtime build ID (for example,
403788). This is a one-time migration or a retry of runtime publication, not a rebuild of ROOT/musrfit. - The workflow restores and validates that artifact, then publishes its archive,
descriptor, and checksum to the linked musrflow-runtime-bundle Generic
package. The registry version includes
linux-x64and the full archive SHA-256. - Download the runtime-pin artifact from the completed run. Review its
runtime-source.json: ROOT version, musrfit source revision, runtime identity, descriptor URL, and descriptor/archive SHA-256 hashes. - Replace
packaging/runtime/runtime-source.jsonwith that reviewed file, commit, and push. Subsequent builds/tags use it automatically; remove the legacy repository variable if no longer needed.
New Build runtime runs also publish this durable bundle and emit a candidate pin. They never change the approved pin automatically. The archive includes the full manifest (tool fingerprints, source revision, build options, base-image identity, platform, and architecture), so different builds cannot overwrite each other. Only clean, source-pinned Linux x64 bundles are accepted by this publisher. The checked-in initial pin is deliberately empty: do not substitute the older local development runtime for the validated CI runtime.
Package cleanup policies still apply: exclude approved runtime bundles from automatic registry cleanup. If a runtime package or its credentials become unavailable, the release fails clearly without using a cached or latest runtime.
The old build_runtime=false option is removed: skipping a build does not
supply a runtime on a fresh runner. The two workflow files are
build-runtime.yml and
build-and-package.yml.
The latter builds Linux packages; build-windows.yml
builds the Windows installer with its bundled WSL runtime. Both run on version
tags and support manual builds. The standalone publisher remains available
for recovery as described below.
Both workflows use pinned artifact actions. PSI's runner must support their Gitea adaptation and artifact storage. An upload preflight failure must be resolved before compilation; a download failure should be checked for an incorrect run ID, expired artifact, or Actions-token permissions. Artifact download does not require a personal token; PSI registry publication uses the PACKAGES_TOKEN secret described below.
Release automatically from a version tag
Prerequisites: commit an approved runtime pin (or, during migration, set
MUSRFLOW_RUNTIME_RUN_ID to an unexpired artifact) and keep PACKAGES_TOKEN
configured. The tagged commit must
contain both packaging workflows. Restrict who can push v* tags: those pushes publish
packages using repository secrets.
-
Update
package.jsonandpackage-lock.jsontogether, for example withnpm version 1.0.0-rc.7 --no-git-tag-version. Update release notes/version references as needed, test, and commit the version changes. -
Create an annotated tag matching the package version exactly and push it to Gitea. For example, after committing a new version
1.0.0-rc.7:git tag -a v1.0.0-rc.7 -m "muSRFlow 1.0.0-rc.7" git push gitea master git push gitea v1.0.0-rc.7 -
Build and package and Build Windows installer start automatically. Both reject mismatched tags before downloading the runtime, then validate, test, build, archive, and publish their platform's packages.
-
Open Packages: tag
v1.0.0-rc.7publishes registry version 1.0.0-rc.7, without a build-ID suffix. Existing different files are never overwritten; do not move a released tag to rebuild different contents. -
Once both platforms are published, open Releases and review the new draft. It contains direct registry download links for all four Linux RPM/AppImage files and the Windows
.exe, SHA-256 values and checksum links, source commit, both packaging run IDs, and the runtime manifest link. Smoke-test the downloads, edit the release notes, then publish the draft.
The first finished workflow reports Release pending if the other platform
is still missing. The last publisher creates the shared draft, after checking
that all package records refer to the same version, tag, and source commit.
If one build fails, its counterpart can still publish packages, but no incomplete
draft is created. Recover the failed build/publication; do not retag an existing
release. The existing v1.0.0 tag predates this automation and must not move.
Release-candidate/beta versions are marked as prereleases; stable versions are not. The Release remains a draft in either case. Package files are already in the registry, whose visibility follows Gitea's package access policy; a draft Release does not make those files private. Release downloads are links to the registry, not duplicated attachments. Publishing the draft does not trigger a second build: only tag pushes and explicit manual dispatches trigger this workflow. Tag deletion is ignored. Manual dispatches, even when selecting a tag, still use build-specific registry versions and do not create a Release page.
Draft creation requests contents: write using the built-in job token. If PSI
rejects that API call with HTTP 401/403, configure a separate RELEASES_TOKEN
Actions secret scoped to write:repository, owned by a user with release
write access. The package-only PACKAGES_TOKEN is not reused for release
API calls. Retry Publish packages with the original packaging run ID; no
rebuild is needed. See Gitea's release API.
The artifact includes release-context.json with the original tag, version,
source commit, and packaging run ID. Recovery uses this file, not the newer
checkout's package.json or the recovery workflow's ref. The draft step checks
that the remote tag still points to that commit and never creates a missing
tag. It preserves existing release notes and draft/published status when the
release contains the matching build-provenance marker; an unrelated existing
Release fails rather than being replaced. Keep the generated HTML provenance
comment when editing release notes if you want future retries to recognize it.
Retry publication without rebuilding
Build and package and Build Windows installer publish automatically. Use the standalone Publish packages workflow only for older builds or to retry a registry or draft-creation failure. A combined run may be marked failed even though its complete package artifact was uploaded successfully. The recovery workflow verifies that it is a finished packaging run with the expected, unexpired artifact; a runtime run, missing artifact, or unfinished run is rejected with a clear error.
- Push the workflow changes, then open Actions -> Publish packages -> Run workflow on the updated branch.
- Select platform (
linuxorwindows) and enter package_run_id, the matching Build and package or Build Windows installer workflow run whose installer artifact upload succeeded. This is not the runtime run ID or a job/task ID. New packaging runs print it in Check runtime selection asPackaging run ID for Publish packages. Older upload logs also print an Artifact download URL: the number immediately after/actions/runs/in that action-generated URL is the run ID (not the final artifact ID). Alternatively, openhttps://gitea.psi.ch/api/v1/repos/salman/muSRFlow/actions/runswhile signed in, find the successful packaging entry by itshtml_url/head_sha, and use itsidfield. Do not confuse that withrun_numberor assume that the browser URL's number is the API run ID. Private repositories may require authenticated API access rather than a browser session. - The publisher downloads musrflow-linux-packages or musrflow-windows-x64, checks every installer against its SHA-256 and MD5 sidecars, uploads the files, and links the packages to this repository.
- Open the repository's Packages tab. There are three installer packages: musrflow (application RPM/AppImage) and musrflow-runtime (runtime RPM/AppImage), plus musrflow-windows (unsigned x64 NSIS installer with bundled WSL runtime). Each includes checksums and build-source information; the runtime and Windows packages also include a runtime manifest. Separate namespaces prevent Linux and Windows build metadata from colliding.
- For tagged artifacts, the final step creates the missing draft once both platforms are published, or preserves an already recognized Release. For manual/older artifacts it does nothing. Retry from the updated default branch to use publisher fixes while retaining the original release version.
Manual registry versions use <app-version>-build.<packaging-run-ID>, for example
1.0.0-rc.5-build.12345. The application version and downloaded filenames stay
unchanged. The version is read from the selected artifact, not from the newer
publisher checkout. Separate builds cannot silently replace each other.
Retrying the same publication checks existing files byte-for-byte by SHA-256
and skips identical uploads; different contents fail without deleting files.
Gitea repository links apply to every version of a package. If linking returns
HTTP 400 because a link already exists, the publisher verifies the package's
repository metadata and continues only when it matches this repository. It
never silently ignores that error or moves a package from another repository.
Publication is not atomic: a failed upload may leave a partial package. The
publisher writes each package's release context last to mark upload completion.
Rerun Publish packages with the same platform and ID to complete it. If all
packages are present but draft creation failed, retry either platform's tagged
run. Concurrent draft creation is handled without overwriting release notes.
Both publishing paths request packages: write for the built-in job token.
PSI rejected that token for registry uploads (HTTP 401); the tested setup uses a
repository Actions secret named PACKAGES_TOKEN with a token owned by
the package owner and scoped to write:package. If it is already configured,
no additional secret is needed for the combined workflow. Do not put tokens in files
or workflow inputs. Also ensure the repository's Packages feature is enabled.
The secret is used for registry downloads/publication and reading package
metadata when assembling the draft, never passed into build containers. Actions
artifact download still uses the job token. Other Gitea servers may allow the built-in token
fallback, but do not remove the working PSI secret.
This uses Gitea's Generic Package Registry,
not an RPM installation repository, and explicitly
links packages to the repository.
It never creates a Git tag; the final step creates a draft Release only for a
validated tagged artifact. Registry files are independent
of the 30-day Actions artifact retention, but remain subject to server package
cleanup policies. The offline runtime .tar.gz/runtime-download.json bundle
is published separately by Build runtime / Publish runtime. The installer
publisher exposes Linux RPM/AppImage files and the Windows .exe.
Build the Windows/WSL installer on a runner
The Windows installer has passed installation, runtime setup, data download,
Fit/Plot, and multi-run smoke tests. Build Windows installer now runs on
version tags as well as manually. It uses PSI's Linux ubuntu-latest-full runner with
Podman; it does not depend on the old Windows runner or nested WSL support.
- Push the workflow commit. Open Actions -> Build Windows installer -> Run workflow on the desired source branch.
- Leave
runtime_run_idempty to use the approved registry pin, or supply403788(or another approved, unexpired runtime run) during migration. - The job verifies/restores the same Linux runtime, runs the regression tests,
and stages it into a WSL rootfs. The base image is taken from the runtime's
recorded digest. Tool startup and ROOT's
PMusrCanvas.hheader loading must succeed inside that rootfs before it is exported. - A separate Wine-enabled container runs electron-builder 26.15.3 to produce the unsigned x64 NSIS installer. Only committed application files and the required runtime payload are staged into it; Git credentials and workflow secrets are not passed to the build container.
- Download musrflow-windows-x64 from the run. It contains the
.exe, MD5 and SHA-256 sidecars, runtime manifest, rootfs checksum, and build provenance. Failure logs are available as windows-build-logs. - The workflow publishes the installer as musrflow-windows in Packages.
Manual builds use
<version>-build.<run-ID>; tag builds use<version>and participate in the shared Linux/Windows draft Release described above.
The builder defaults to docker.io/electronuserland/builder:wine, resolves it
to an immutable digest before building, and records that digest. To approve a
specific builder permanently, set repository variable
MUSRFLOW_WINDOWS_BUILDER_IMAGE to the recorded ...@sha256:... reference.
The actual package script refuses an unpinned image. See
electron-builder's Windows-on-Linux guidance.
The workflow compares the rootfs and runtime markers in the unpacked Electron application with the validated inputs, checks the installer executable header, and writes checksums. These are packaging checks, not a Windows installation test. New releases should still be smoke-tested on a Windows PC with WSL2/WSLg: install the application, let it import its runtime, then verify Preferences, data download, Fit, and interactive Plot. Also test updating an existing installation, whose already imported WSL distribution is intentionally retained. The installer is unsigned, so Windows may show its normal unsigned-publisher warnings.
This preserves the existing Windows model: one installer with a bundled WSL rootfs, not a new native Windows ROOT runtime or a separate optional Windows runtime installer.
Both container build scripts now use unique names and remove only containers they created. WSL exports are written to a temporary file and replace the previous rootfs only after successful export and gzip validation.
musrfit sources and compilation
Run the commands below from the muSRFlow repository root on the Linux build
host. By default, compilation uses the local sibling checkout
../musrfit.psi. For example:
/home/l_salman/LEM/git/muSRFlow # this application
/home/l_salman/LEM/git/musrfit.psi # musrfit sources
The build compiles the files currently in that checkout, including local changes. It does not clone, fetch, or pull musrfit automatically. Select and update the intended source revision yourself before building a release.
Compile ROOT and musrfit into this repository's runtime/ directory:
bash packaging/runtime/build.sh
To use a different source checkout, supply an absolute path:
MUSRFIT_REPO=/path/to/musrfit bash packaging/runtime/build.sh
The checkout is mounted read-only at /src/musrfit inside the build container.
ROOT is downloaded and compiled by default; see the
runtime build guide for options.
Compilation and packaging are separate. The npm run dist:* commands
package existing scientific binaries; they do not recompile musrfit. Rebuild
runtime/ after source changes, then create the platform packages below.
Linux packages
npm run dist:app:rpm # muSRFlow application RPM only (no runtime artifacts)
npm run dist:app:appimage # muSRFlow application AppImage only (no runtime artifacts)
npm run dist:app:linux # muSRFlow application RPM + AppImage only (no runtime artifacts)
npm run dist:rpm # application RPM and runtime artifacts
npm run dist:appimage # application AppImage and runtime artifacts
npm run dist:linux # both application formats and runtime artifacts
Use the dist:app:* commands when you only want the lean muSRFlow application
package and will provide musrfit separately (system installation, installed
musrflow-runtime package, or a user-configured tools directory). These do not
require a local runtime/ tree.
The dist:rpm, dist:appimage, and dist:linux commands also package the
matching separate runtime artifact(s), plus the runtime download bundle. Build
the scientific runtime first with packaging/runtime/build.sh if runtime/ is
not ready or you need to include changes from the musrfit source checkout, or
set RUNTIME_DIR to an existing validated runtime.
| Artifact | Filename or directory |
|---|---|
| Application RPM | dist/musrflow-<version>-x86_64.rpm |
| Application AppImage | dist/muSRFlow-<version>-x86_64.AppImage |
| Runtime RPM | dist/musrflow-runtime-<version>-x86_64.rpm |
| Runtime AppImage | dist/musrflow-runtime-<version>-x86_64.AppImage |
| Offline runtime bundle | dist/runtime-downloads/, with runtime-download.json, archive, and checksum |
npm run dist:runtime builds only runtime artifacts.
npm run dist:runtime:archive builds just the plain runtime download bundle
without the RPM/AppImage packaging tools. The AppImage runtime builder needs
the electron-builder AppImage cache; see the runtime guide for prerequisites.
Building the Windows installer
The complete sequence, from source compilation to installer, is:
bash packaging/runtime/build.sh # Compile ROOT and the selected musrfit checkout
bash packaging/wsl2/build-wsl2.sh # Copy runtime/ into a new WSL filesystem archive
npm run dist:win # Package the application and that archive
For a different musrfit checkout, prefix the first command with
MUSRFIT_REPO=/path/to/musrfit. Skip compilation only when runtime/ already
contains the intended binaries. After rebuilding it, regenerate the WSL
archive before packaging; otherwise the installer still carries the old tools.
The rootfs builder uses Docker or Podman and includes the distribution libraries
and Boost headers needed for plotting. It checks executable startup and ROOT
plotting-header loading before exporting
packaging/wsl2/out/muSRFlow-runtime-rootfs.tar.gz.
dist:win packages the existing archive; it does not rebuild it. The result is
dist/muSRFlow-<version>-x64.exe, including both the app and the WSL2 runtime.
See WSL packaging for implementation details.
Existing Windows installations keep their imported runtime. Link users to the Windows update instructions when distributing a runtime-related fix; reinstalling the app alone does not update that distribution.
Release validation
- Run
npm testwith the required scientific tools available. Record any environment-dependent checks that could not be exercised. - Install each package on its target OS. Check the version in Help -> About.
- Follow the platform installation guide, including runtime setup and separate work/data directories.
- Exercise Plot, Fit, FFT, series/global fitting, parameter plotting, and MSR editing with known data. Confirm parameter feedback and result files.
- Test upgrades of existing installations as well as a fresh installation. Windows testing must include an interactive WSLg spectrum window.
Linux-container tests have exercised the Windows runtime's tools, a real fit, and PNG generation. Those tests do not replace interactive Windows testing.
Installation links retained for older references
Installing on Windows
The complete user guide is now Windows installation.
Installing an RPM
See Linux application installation.
Running the AppImage
See Linux application installation.
Installing the standalone runtime
See Linux runtime setup.
Configuration link scheme
muSRFlow registers the musrflow:// URL scheme so the operating system and
browsers can hand a musrflow://open/#c=... configuration link to the installed
application (see the shared-configuration notes in the user manual). The app
claims the scheme at startup with
app.setAsDefaultProtocolClient("musrflow").
- RPM — electron-builder writes a
.desktopentry that carriesMimeType=x-scheme-handler/musrflow;, so the desktop registers the handler on install. No extra step is needed. - AppImage — an AppImage is not installed, so nothing registers the scheme
by default. Integrate it first (for example with AppImageLauncher or the
AppImage's own desktop-integration step); afterwards the
musrflow://links launch the app. Without integration the links cannot be opened, but the canonicalhttp://link still restores through Restore configuration link.
The launch path accepts the same links as the web form: the full
http(s)://...#c=... URL, the bare #c=... fragment, and musrflow://open/
(optionally with a path component) followed by the fragment. Legacy web-style
deep links are also accepted: musrflow://host/muSRFlow?action=plot&YEAR=...&BeamLine=...&RunNumbers=...
(or the equivalent http(s)://.../muSRFlow?... URL). Those carry the run/beam-line
selection in the query string instead of an encoded fragment and initialize the
run controls, running the plot when action=plot is present.
Versioning
package.json is the single source of the desktop application version;
Electron reports it through app.getVersion() and the About dialog.
package-lock.json should carry the same version.
For a version change, update package.json, package-lock.json,
tests/release-packaging.test.js, and CHANGELOG.md together. Run the tests,
rebuild the manuals and installers, and commit before tagging the release.
Check the remaining release gates in TODO.md before tagging 1.0.
npm run checksums produces MD5/SHA-256 sidecars for top-level RPM and AppImage
artifacts. It does not cover Windows installers. For a Windows release, generate
and publish a SHA-256 checksum for the actual installer as well. Runtime download
bundles include their own SHA-256 sidecar and descriptor.
Application icon
Linux and Windows packages use assets/musrflow-icon.png through the
platform icon settings in package.json. electron-builder converts the
512-pixel PNG to Windows ICO format for the executable; the NSIS installer
and uninstaller inherit the application icon.
After changing the icon, rebuild with npm run dist:win and install the new
package. No ROOT/musrfit or WSL runtime rebuild is needed for an icon change.
Existing installations do not pick up the new icon from source changes alone.