Minimal template for publishing a Haxe library to haxelib through GitHub Releases.
src/for library source codetests/for lightweight test entry pointscli/Main.hxas the CLI entry pointbuild_cli.hxmlto compile the CLI to Nekobuild_tests.hxmlfor local test execution- optional
haxelib.jsonfor package metadata overrides .github/scripts/generate_haxelib_json.pyto buildpackage/haxelib.json.github/workflows/publish-haxelib.ymlto publish on release
- Add your library code under
src/. - Optionally create
haxelib.jsonif you want to override generated metadata such asname,classPath,contributors, ordependencies. - Update tests in
tests/so they compile against the real library. - Create a GitHub Release with a semantic version tag such as
v0.1.0. - The workflow generates
package/haxelib.jsonand submits the package to haxelib.
Optional haxelib.json overrides:
nameclassPathcontributorsdescriptionif the GitHub repository description is emptylicenseif automatic SPDX to haxelib mapping is not enoughdependencieswhen your library requires other haxelib packages
Set GitHub Actions secrets:
HAXELIB_PASSWORDrequiredHAXELIB_USERoptional for explicit username-based submit
Run tests:
haxe build_tests.hxmlRun the CLI entry point locally:
haxe build_cli.hxml
neko run.nsrc/Library.hxandtests/Main.hxare starter stubs
This directory contains the public library source that will be shipped to haxelib.
- Put reusable library code here.
- Keep package names aligned with the library name you plan to publish.
- Only files copied into
package/srcare included in the published package. - The runnable CLI entry point lives separately in
cli/Main.hx.
src/Library.hx is only a stub. Replace it with your real modules or remove it if you do not need a root source module under src/.
This directory contains the CLI entry point and generated Neko binary.
cli/Main.hxis compiled bybuild_cli.hxml.run.nis generated in the package root during local builds and during release packaging.- Keep command-line bootstrap logic here instead of mixing it into the library source tree.
This directory contains compile-time or runtime tests for the library.
build_tests.hxmladdstests/to the class path.Mainis the default test entry point.
Suggested usage:
- smoke tests that compile the public API
- regression tests for fixed bugs
- small interpreter-based checks with
--interp
tests/Main.hx is intentionally empty and should be replaced with real assertions or compile checks.
The release workflow:
- Checks out the published Git tag
- Installs Haxe and Python dependencies
- Copies the configured
classPath,cli/,build_cli.hxml,README.md,LICENSE, and optionalCHANGELOG.mdintopackage/ - Compiles
run.nin the package root - Generates
package/haxelib.jsonfromhaxelib.json, repository metadata, and the release body - Publishes
package/withhaxelib submit
releasenotecomes from the release body; if it is empty, the workflow uses the release title, and if that is also empty, it usesNew release.- Repository topics are used as package tags when
tagsare not set inhaxelib.json. - The generated package version comes from the Git tag unless
versionis set manually. - If
haxelib.jsonis missing or does not defineclassPath, the workflow usessrc. contributorscan be omitted fromhaxelib.json; the release script falls back to GitHub contributors.