·5 min read
Two things my DiskDesk release workflow got wrong in its first hour
The DiskDesk release workflow was written to run once: push a tag, get a portable exe and an installer on a GitHub release. Within minutes of the 1.0.0 commit I had two follow-up fixes to it, 14 seconds apart in the log. Neither was about DiskDesk. Both were about assumptions I had made about how a CI job gets run.
- Project
- DiskDesk
- Date
- Sep 2026
- Stack
- GitHub Actions, PowerShell, Inno Setup, PyInstaller
- Commit
- 3b8509f
What the workflow does
DiskDesk is a Windows app, and its in-app updater looks for files on a GitHub release. The workflow's header comment states the contract: tag a commit, for example git tag v1.1.0 && git push origin v1.1.0, and the portable exe and the installer are attached to the release where the updater looks for them.
The job runs on windows-latest and goes through a short list of steps: work out the version, check it, install dependencies, draw the icon with tools/make_icon.py, build with python -m PyInstaller diskdesk.spec --noconfirm, build the installer with Inno Setup, rename the assets, upload an artifact, and publish.
Two triggers exist. A tag matching v* is the real release path. workflow_dispatch takes a version input, builds everything and uploads the artifact, but the publish step is guarded with if: github.event_name == 'push', so a manual run can never create a release by accident. That split is deliberate: I want to be able to test the build without touching the thing the updater reads.
A guard against tagging the wrong version
Before anything is built, a step compares the tag with the version declared in code:
declared=$(python -c "import re,pathlib;print(re.search(r'__version__ = \"([^\"]+)\"', pathlib.Path('diskdesk/__init__.py').read_text()).group(1))")
if [ "$declared" != "${{ steps.version.outputs.version }}" ]; then
echo "Tag says ${{ steps.version.outputs.version }}, __version__ says $declared."
echo "Bump diskdesk/__init__.py before tagging."
exit 1
fiThis matters because the updater compares versions. A release tagged v1.1.0 that contains a binary reporting 1.0.0 would look permanently out of date to itself. Failing in the first minute of the job is much cheaper than shipping that.
Fix one: the release already exists
The first version of the last step was:
gh release create "${GITHUB_REF_NAME}" dist/*.exe \
--title "DiskDesk ${GITHUB_REF_NAME}" \
--generate-notesgh release create creates a release, and it fails if one already exists for that tag. There are ordinary ways to get there: a tag pushed by hand after a release was drafted in the web UI, or a rerun of a job that had already published once. In both cases all the expensive work succeeded and the very last command refused to finish. The commit message names the two cases: a tag pushed by hand, or a rerun.
The replacement checks first:
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" dist/*.exe --clobber
else
gh release create "${GITHUB_REF_NAME}" dist/*.exe \
--title "DiskDesk ${GITHUB_REF_NAME}" \
--generate-notes
fi--clobber replaces assets of the same name, which is what a rerun should do. It makes the step safe to run twice, and that property is what I want from any publishing step. One tradeoff is visible in the code: when the release already exists, the title and notes are left alone. A rerun fixes the files, not the description, which seems right to me, since someone may have edited the notes by hand.
Fix two: the path with parentheses
The installer step needs Inno Setup's compiler. The workflow installs it with Chocolatey and then calls it by full path. The first attempt was:
& "$env:ProgramFiles(x86)\Inno Setup 6\ISCC.exe" ...The fix, in ce2fe5b, is one line:
& "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" ...The commit message says only that it quotes the Program Files (x86) path for pwsh. The reason is a PowerShell parsing rule. In a double-quoted string, $env:ProgramFiles is read as the variable, and the (x86) after it is just literal text, so the expansion produces a path with (x86) glued onto the end of Program Files instead of the real folder name, Program Files (x86). The environment variable's actual name contains parentheses, which is why it needs the ${env:...} form. I did not capture the failing run log, so this is the language rule rather than a quoted error.
It is an easy mistake because the same text works in cmd syntax and looks fine on the page. It also fails late: after PyInstaller has already built the exe, which is the slow part of the job.
Order of the failures
The two bugs have something in common. Both sit at the edges of the job: the installer call is near the middle, the publish is at the very end, and both failed after the slow steps. If I did this again I would make a short manual dispatch that exercises the installer step first. The workflow_dispatch input is already there for that, and the push guard on publish means it is safe to use.
What I took from it
A release job gets run in situations the author did not picture: a rerun, a hand-pushed tag, a different shell's quoting. The edits that matter are not clever. They check state before creating it, they make a repeated run harmless, and they refuse to build when the version in code and the tag disagree. Those are the same three habits I would want in any deployment script.
#github-actions#powershell#ci#windows
Keep reading
Have a project in mind?