Series: Building Level Time, part 3 of 4. Part 1: Addon architecture · Part 2: Testing Lua with Go · Part 3: Release pipeline · Part 4: Goals and the public API · Product page: Level Time
Once an addon works, it still has to reach the players, and I did not want to click through several upload forms for every version. For Level Time, a World of Warcraft addon that tracks time, XP and kills per level, I wanted one rule: I push a git tag and everything else happens by itself.
In this post I walk through the whole path from git tag to a file on CurseForge: the GitHub Actions workflow, the BigWigs packager, the .pkgmeta file, the .toc files that serve several game clients, a trick for shipping a second addon from the same repository, and the small Go installer I use to test builds in my own WoW folders.
Everything here is taken from the repository’s release.yml, .pkgmeta, Makefile and tools/installer. Comments in the repo are in German; I translated the relevant ones.
The goal: a tag is a release
The workflow triggers on tags matching v*. Nothing else publishes. Regular pushes to main and pull requests run a separate Test workflow (make vet and make test), so a broken test is usually found long before I tag.
The release workflow, trimmed to its skeleton:
name: Release
on:
push:
tags:
- "v*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: "1.27"
- run: make test
release:
needs: test # no green tests, no release
runs-on: ubuntu-latest
permissions:
contents: write # needed to create the GitHub release
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # the packager needs history for version and changelog
- uses: BigWigsMods/packager@v2
Three details matter here.
needs: test. The release job only starts when the test job passes. The tests are the Lua scenarios I describe in Part 2: Testing Lua with Go, plus the tests of the installer and the other Go tools. A tag on a red commit therefore produces no release. See the GitHub docs on needs.
fetch-depth: 0. actions/checkout fetches a single commit by default. The packager derives the version from the git history and builds the changelog from commit messages, so it needs the full history and the tags.
contents: write. Creating a release needs write permission on repository contents. I grant it to the release job only, not to the test job. See Automatic token authentication.
The BigWigs packager
The packager is a bash script maintained by the BigWigs team and widely used in the addon ecosystem. It does a handful of jobs that are tedious by hand:
- Copy the addon files into a clean folder, skipping everything in the
ignorelist. - Replace keywords such as
@project-version@in the files. - Generate a changelog from the git history.
- Zip the result.
- Upload to the platforms the project has configured, and create a GitHub release.
The action BigWigsMods/packager@v2 wraps the script. Which platforms it uploads to is decided by two things per platform: an ID in the .toc file and an API token in the environment. The workflow header documents the contract:
| Platform | .toc line | Secret |
|---|---|---|
| CurseForge | ## X-Curse-Project-ID | CF_API_KEY |
| Wago | ## X-Wago-ID | WAGO_API_TOKEN |
| WoWInterface | ## X-WoWI-ID | WOWI_API_TOKEN |
If an ID or token is missing, that platform is skipped. If everything is missing you still get the GitHub release, which is a nice property: the pipeline degrades gracefully instead of failing. Currently my .toc files carry a CurseForge project ID only (1721235 for Level Time, 1744370 for Level Time Goals). The tokens are repository secrets passed in as environment variables; their values never appear in the repo.
Naming the upload
By default the packager names the file after the tag, such as v2.26.0. I prefer the same name everywhere, so the workflow passes -n:
- uses: BigWigsMods/packager@v2
with:
args: -n "{package-name}-{project-version}:{package-name}-{project-version}.zip"
The format is {file name}:{label}. Both parts expand to LevelTimer-v2.26.0, so the zip and the CurseForge display name match the files from the days when I uploaded by hand. The placeholders are described in the packager README.
.pkgmeta: what goes in the zip
The packager ships the repository minus what .pkgmeta ignores. That is a deny-list, and that has a consequence: every new non-addon file in the repo must be added to ignore, or it ends up in the zip. This is the full file, with the comments translated:
# Config for the BigWigs packager (.github/workflows/release.yml).
package-as: LevelTimer
# Load-on-demand archive: its own addon folder next to LevelTimer/
move-folders:
LevelTimer/LevelTimer_Archive: LevelTimer_Archive
ignore:
- tests
- StreamGoal
- tools
- curseforge
- Makefile
- README.md
- ROADMAP.md
- ManualToCheck.md
- image.png
Walking through it:
package-assets the folder name inside the zip. The repository is calledwow-statistics, but WoW expects the addon folder to match the.tocfile name, so the folder must beLevelTimer.move-folderssolves a placement problem. Level Time has a second, load-on-demand addon,LevelTimer_Archive, a journal archive that is only loaded when needed. WoW only sees addons that sit directly inInterface/AddOns/. Since the archive lives in a subfolder of the repository, the packager first puts it atLevelTimer/LevelTimer_Archive/andmove-folderslifts it to the top level of the zip. The archive’s own.toccarries## LoadOnDemand: 1and## Dependencies: LevelTimer.ignoreexcludes tests, Go tools, CurseForge texts and project docs. AlsoStreamGoal, which is a separate addon with its own package (next section).
For the full list of directives see the .pkgmeta documentation.
One .toc, several game clients
World of Warcraft exists in several flavors: Retail, Classic Era and others. They share the addon format but not the full API. The .toc header of Level Time lists several interface versions in one line:
## Interface: 120105, 11509, 20506, 16001
## Title: Level Time
## Version: @project-version@
## Author: Nerzal
## X-Curse-Project-ID: 1721235
## SavedVariables: LevelTimerDB, LevelTimerStatsDB, LevelTimerDebugLog
The comma-separated ## Interface list lets one .toc serve several clients, as described on the TOC format page of the WoW wiki. The project notes in the repo state the rule that follows from it: an API call must either exist on all listed clients or be guarded, because there is no per-flavor build. In Lua that is a plain if GetPVPSessionStats then ... check. The structure behind this is part of Part 1.
The ## Version: @project-version@ line is the placeholder the packager replaces with the tag. The Go installer replaces the same token, so a locally installed build reports a version too.
Two addons, one repository
Level Time Goals is a second addon, lives in the StreamGoal/ folder, depends on Level Time (## Dependencies: LevelTimer) and has its own CurseForge project (ID 1744370). I cover how it works in Part 4. For the pipeline it poses a problem: the packager expects the addon to sit at the root of a git repository, and its -t flag even requires a .git there.
My solution is a second packager run against a throwaway clone whose root is StreamGoal/:
- name: Split StreamGoal history
run: |
git clone -q . sg-repo
cd sg-repo
git filter-branch -f --subdirectory-filter StreamGoal --tag-name-filter cat -- --all
git checkout -q "$GITHUB_REF_NAME"
- uses: BigWigsMods/packager@v2
env:
GITHUB_OAUTH: "" # otherwise a second GitHub release is created for the same tag
with:
args: -t sg-repo -n "{package-name}-{project-version}:{package-name}-{project-version}.zip"
git filter-branch --subdirectory-filter rewrites the clone so the contents of StreamGoal/ become the repository root, and only commits that touched that folder remain. --tag-name-filter cat rewrites tags along with the history. A nice side effect is that the changelog for Level Time Goals then contains only commits that actually changed that addon.
Two caveats:
git filter-branchis flagged by Git itself as discouraged.git filter-repois the recommended successor, but it is an extra dependency and the clone is disposable, so I have kept the built-in command so far.- Blanking
GITHUB_OAUTHfor the second run is deliberate. The first run already created the GitHub release for the tag; without that line the second run would try to create another one.
The version token works in both runs because both .toc files contain @project-version@.
Changelog and versioning
I use plain semantic-style tags: v2.25.0, v2.25.1, v2.26.0. Patch for fixes, minor for features. For a tag build the packager’s project version is the tag name.
The changelog is generated by the packager from the git history. There is no hand-written CHANGELOG.md in the repository, so the quality of the release notes is the quality of my commit messages. That is a trade-off: it costs no maintenance, but it rewards disciplined commits. The listing text on CurseForge (description and logo) lives separately in the curseforge/ folder and is edited by hand, because it describes the addon rather than a single release.
Local builds use the same idea: the Makefile computes VERSION with git describe --tags --always --dirty, so a local zip is named something like LevelTimer-v2.26.0-3-gabc1234-dirty.zip and cannot be confused with a real release.
The Go installer
The release pipeline covers the public path. For my own testing I need the opposite: a fast way to put the working copy into my WoW folders, for every game version I have installed. Copying by hand gets old after the third time, and an old file left behind in the addon folder can silently load stale code. So tools/installer is a small Go program, using only the standard library, tested with go test like everything else in the repository.
What it does, in order:
- Reads the file list from the
.toc. There is one place that says which files belong to the addon (the.toc), plus everything underMedia/. No second list to keep in sync.LoadAddonsalso discovers every sub-folder that contains<folder>/<folder>.toc, so Level Time Goals and the archive are picked up automatically. - Finds the WoW folder. Priority: the
-wowflag, then theWOW_DIRenvironment variable, then auto-detection. Auto-detection scans typical locations on Windows (drive lettersC:toZ:, folders such asWorld of Warcraft,Games\World of Warcraft,Program Files (x86)\World of Warcraft) and macOS (/Applications/World of Warcraft). On Linux there is no auto-detection, so you pass-wowor setWOW_DIR. - Finds the flavors. Every sub-folder named like
_retail_or_classic_era_counts. You may even point-wowat a flavor folder and it steps up one level. - Builds a plan per addon and flavor by comparing bytes: new file (
+), changed (~), unchanged, or stale (-), meaning it was installed earlier but is no longer in the.toc. - Shows the plan and asks.
-dry-runstops here,-yesskips the question and by default updates the flavors that are already installed. - Applies it. Each file is written to a temporary file and renamed, so the game never reads a half-written file. Then it writes
.install-manifest.jsoninto the addon folder with the version, the file list and applied migrations.
The manifest is what makes stale-file cleanup safe. The installer only deletes files it knows it installed earlier. For old manual installs without a manifest it removes only code files (.lua, .toc, .xml) that are no longer referenced by the current .toc.
The one rule it must never break
SavedVariables are where players’ data lives: history, settings, everything. They sit under the WTF folder. The installer therefore refuses any path that contains a WTF component, checked once for the target and again for every file it writes (ensureNotConfigPath, safeJoin). It also rejects relative paths that would escape the addon folder. A tool that overwrites your save data on a typo would be worse than no tool.
After an install the output tells you whether /reload in game is enough, or whether the client must restart because the .toc changed. WoW only reads .toc files at startup.
Using it
The Makefile wraps the common cases.
Linux / macOS
# Interactive wizard: choose flavors, review the plan, confirm
make install
# Update every already-installed flavor without questions
make update
# Show what would change, write nothing
make dry-run
# Explicit WoW path (required on Linux)
make install ARGS="-flavors retail -wow '$HOME/Games/World of Warcraft'"
Windows (PowerShell)
You can use make if you have it, but the Go tool itself only needs Go:
# Interactive wizard from the repository root
go -C tools/installer run . -src "$PWD" -version dev
# Dry run for one flavor with an explicit path
go -C tools/installer run . -src "$PWD" -version dev -dry-run -yes `
-flavors retail -wow "D:\Games\World of Warcraft"
To install Go see go.dev/doc/install. The -C flag of the go command needs Go 1.20 or newer, and CI uses Go 1.27.
The same program builds the manual download. make package runs it in -package mode and writes dist/LevelTimer-<version>.zip (with the archive addon inside) and dist/StreamGoal-<version>.zip. That is a handy local rehearsal of what the packager will produce, but the official release zip comes from the packager, not from this path.
If you are interested in how I handle Go tooling elsewhere, Dockerizing Go applications covers a different corner of that toolbox.
Other Go tools in the repository
The tools/ folder holds more programs. A line each, because they are not part of the release path itself:
tools/addontestis the test harness from Part 2.tools/artworkdraws the CurseForge logo and the in-game icon and textures (make artwork), so the visuals are reproducible code rather than binary files nobody can edit.tools/recordsfetches speedrun records from speedrun.com and regeneratesSpeedrun/SpeedrunRecords.lua(make records, needs internet).tools/flightsreads the flight times that the addon measured itself from the SavedVariables of every flavor (read-only) and generatesAssist/FlightTimesData.lua(make flights). The project notes say to run it before a release to ship the newest measurements.
How to cut a release
The checklist I follow. Replace the version with your next one.
Linux / macOS
# 1. Be on a clean, up-to-date main
git switch main && git pull --ff-only
# 2. Run what CI will run
make vet && make test
# 3. Tag and push the tag; this triggers the Release workflow
git tag v2.27.0
git push origin v2.27.0
# 4. Watch the run
gh run watch
Windows (PowerShell)
git switch main; git pull --ff-only
# Same checks as CI
make vet; if ($?) { make test }
git tag v2.27.0
git push origin v2.27.0
gh run watch
The GitHub CLI (gh) is optional; the Actions tab shows the same run. If the tests are green, the release job packages, creates the GitHub release and uploads to CurseForge. CurseForge may review a new file for a short while before it appears publicly; that part is out of my hands.
If a release goes wrong, there is no rollback button in the pipeline. I fix forward with a new patch tag (v2.27.1) instead of moving an existing tag, because moved tags confuse packager, GitHub and CurseForge alike.
Lessons learned
- Make the default path the right path. One tag, one command. The fewer manual steps, the fewer forgotten ones.
- Gate releases on tests.
needs: testcosts one line. - Allow-list or deny-list is a real decision. The packager is deny-list based. It is convenient until you forget to ignore a new file. My local
make packageis allow-list based (only what the.tocnames) and works as a cross-check. - Build tools that cannot hurt users, even yourself. The WTF guard in the installer exists because I know I will mistype a path one day.
What’s next
In the last part, Part 4: Goals and the public API, I show how Level Time Goals plugs into Level Time through an exported API and why the two addons are separate. If you want to try the result, the Level Time page links to CurseForge and GitHub.
