Repository navigation
Description
Add semantic-release for automated versioning and npm publishing
Summary
This issue tracks the work to set up semantic-release for @openedx/frontend-base to automate versioning and npm publishing on merge to main.
Findings
Branch configuration
Semantic-release requires at least one non-prerelease release branch. Since main will produce 1.0.0-alpha.X prereleases for now, a placeholder branch needs to exist on the repo to satisfy this constraint. It won't produce releases unless commits are pushed to it. Branch protection should be added to placeholder to prevent accidental pushes that could trigger a stable release.
Tag format
Existing tags use a v prefix (v1.0.0-alpha.13), so tagFormat must be set to v${version}.
npm channel
The package currently publishes to the latest dist-tag. Semantic-release's prerelease branch model defaults the npm dist-tag to the branch name, so channel: "latest" must be set explicitly to preserve the current publishing behavior.
Git notes migration
Semantic-release uses refs/notes/semantic-release to track which npm channel each release was published to. The existing tags have no notes, so a one-time migration is needed:
git notes --ref semantic-release add -m '{"channels":["latest"]}' v1.0.0-alpha.13^{}
git push origin refs/notes/semantic-releaseNote: ^{} is required to dereference the annotated tag to its commit — adding the note to the tag object itself won't work.
Proposed .releaserc
{
"branches": [
"placeholder",
{
"name": "main",
"prerelease": "alpha",
"channel": "latest"
}
],
"tagFormat": "v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}Testing
This was tested on a fork of this repo (brian-smith-tcril/frontend-base) on the test-semantic-release branch, which mirrors main at the time of testing. The .releaserc used for testing can be found at this commit.
The .releaserc on that branch differs from the proposed config above in a few ways:
test-semantic-releaseis used as the prerelease branch instead ofmain(so the dry run can execute from it)repositoryUrlis explicitly set to the fork via SSH (git@github.com:brian-smith-tcril/frontend-base.git) — this is needed locally because semantic-release auto-detects the repo URL frompackage.json, which points to the upstreamopenedx/frontend-base. Without overriding it, branch validation fails against the upstream where the test branches don't exist. SSH is used because the auth verification step (git push --dry-run) requires push access, and SSH keys are configured locally. In CI, aGH_TOKENwould handle this via HTTPS instead.@semantic-release/npmand@semantic-release/githubplugins are omitted — these requireNPM_TOKENandGH_TOKENrespectively, which will be available in CI
The placeholder stable branch also exists on the fork.
To verify the git note on the fork:
git clone https://github.com/brian-smith-tcril/frontend-base.git
cd frontend-base
git fetch origin refs/notes/semantic-release:refs/notes/semantic-release
git notes --ref semantic-release show v1.0.0-alpha.13^{}
# Should output: {"channels":["latest"]}Dry run result (run locally against the fork)
Found git tag v1.0.0-alpha.13 associated with version 1.0.0-alpha.13 on branch test-semantic-release
The next release version is 1.0.0-alpha.14
Remaining work
- Run git notes migration
- Create
placeholderbranch on this repo with branch protection enabled - Add
.releaserc - Add release GitHub Actions workflow (using
OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKENandNPM_TOKENsecrets)
Future work
When this package is ready for a stable 1.0.0 release:
- Remove
prereleaseandchannel: "latest"from themainbranch config so it produces stable versions - Remove the
placeholderbranch from.releasercand the repo (it's only needed whilemainis a prerelease branch) - At that point,
mainwill publish tolatestas a proper stable release, and a separate prerelease branch (e.g.next) can be added for pre-release work
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
brian-smith-tcril commentedon Feb 18, 2026
Log
frontend-base Semantic Release Setup - Work Log
Date: 2026-02-18
Objective
Set up semantic-release for
@openedx/frontend-base.Repo Setup
brian-smith-tcril/frontend-base(fork ofopenedx/frontend-base)upstreamremote from SSH to HTTPS to prevent accidental pushes toopenedx/frontend-basemainfrom forktest-semantic-releasetest-semantic-releaseto origin (required for semantic-release branch validation)placeholderbranch on origin frommain(required stable branch for semantic-release)Current State of the Repo
1.0.0-alpha.13(inpackage.json)1.0.0-alpha.X— will continue with semantic-releasev1.0.0-alpha.0throughv1.0.0-alpha.13(withvprefix — important!)latestdist-tag (no named channel currently)main(notmaster)publishConfig:{ "access": "public" }already setFiles Created
.releaserc{ "branches": [ "placeholder", { "name": "main", "prerelease": "alpha", "channel": "latest" } ], "repositoryUrl": "git@github.com:brian-smith-tcril/frontend-base.git", "tagFormat": "v${version}", "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/npm", "@semantic-release/github" ] }Notes:
repositoryUrlset to fork SSH URL for local auth (CI will use token-based HTTPS)tagFormatusesvprefix to match existing tagschannel: "latest"on prerelease branches to keep publishing to npmlatestdist-tagplaceholderis a stub stable branch required by semantic-release (must have ≥1 non-prerelease branch)mainis omitted from the final config untiltest-semantic-releasetesting is donetest-release.shSimple bash script to run a dry-run locally:
Run with:
. /home/bsmith/.nvm/nvm.sh && nvm use && ./test-release.sh(nvm must be sourced externally since
nvmis a shell function, not a binary)Git Notes Migration
Semantic-release uses
refs/notes/semantic-releaseto track which npm channel each release was published to. The existing tags were created manually and had no notes, so semantic-release couldn't identify the last release.Fix: Added a git note to the commit pointed to by
v1.0.0-alpha.13:git notes --ref semantic-release add -m '{"channels":["latest"]}' v1.0.0-alpha.13^{} git push origin refs/notes/semantic-release --forceKey lessons:
^{}dereferences an annotated tag to its commit), not the tag object itselfchannels: [null]means the default npm dist-tag — but this only works for release (non-prerelease) branches because prerelease branchchannelalways defaults to the branch name, never nullchannels: ["latest"]with explicit"channel": "latest"in branch config is the correct approach for publishing prerelease versions to thelatestnpm dist-tagDry Run Debugging Journey
Error 1:
ERELEASEBRANCHES— current branch not in configRunning from
test-semantic-releasebranch failed because semantic-release validates the current branch against configured branches. Fix: addedtest-semantic-releaseto.releasercand pushed the branch to origin.Error 2:
repositoryUrlpointing to upstreamSemantic-release reads
repositoryUrlfrom therepositoryfield inpackage.json, which points toopenedx/frontend-base. It then validated branches against the upstream repo (wheretest-semantic-releaseandplaceholderdon't exist). Fix: explicitly setrepositoryUrlto the fork SSH URL in.releaserc.Error 3:
EPRERELEASEBRANCHES— duplicate prerelease identifiersBoth
mainandtest-semantic-releasehadprerelease: "alpha". Each prerelease branch needs a unique prerelease identifier. Fix: removedmainfrom the config for now (only needed during testing ontest-semantic-release).Error 4:
EGITNOPERMISSIONSemantic-release runs
git push --dry-runto verify push credentials even in dry-run mode. HTTPS URL required a token. Fix: use SSH URL forrepositoryUrllocally.Error 5: Token errors (
ENOGHTOKEN,EINVALIDNPMTOKEN)@semantic-release/npmand@semantic-release/githubrunverifyConditionseven in dry-run. Fix: removed those plugins from.releaserctemporarily to focus on version determination.Error 6:
No git tag version found— tags not recognizedTags existed and were reachable, but semantic-release couldn't determine the last release. Root causes (found by reading semantic-release source):
git rev-parse v1.0.0-alpha.13returns the annotated tag object, not the commit. Must usev1.0.0-alpha.13^{}."alpha") didn't matchbranch.channel— for a prerelease branch,channeldefaults to the branch name, not theprereleaseidentifier. Required explicit"channel": "latest"and note{"channels":["latest"]}.✅ Dry Run Result
arbrandes commentedon Feb 18, 2026
No objections to the plan of action! Thanks!
arbrandes commentedon Mar 4, 2026
Before we move ahead here, we should agree on the ADR.
arbrandes commentedon Mar 24, 2026
The ADR has merged: we're unblocked!
arbrandes commentedon Apr 2, 2026
I'll create the PRs for the apps.
arbrandes commentedon Apr 2, 2026
This is done for everything but frontend-app-instruct. We're waiting for openedx/axim-engineering#1674 and a package.json rename so it can be published to NPM.
arbrandes commentedon Apr 2, 2026
Done for frontend-app-instruct, too!