Sub topic 14
Tagging and Releasing an Action
This chapter assumes you can write an action.yml, use an action from a workflow, and run basic Git commands for commits, tags, and branches. You have already built and tested an action. Now you will publish it so other workflows can pin to a stable version.
Why versions matter
A workflow refers to your action with uses: owner/repo@ref. The ref can be a branch, a tag, or a commit SHA. If users point at a branch such as main, every push you make changes what their workflows run. A bad commit breaks all of them at once.
Tags solve this. A tag names a fixed point in history, so users choose when to move to a new version.
| Reference | Example | Behavior |
|---|---|---|
| Branch | `@main` | Changes on every push. Risky for users. |
| Full version tag | `@v1.2.3` | Fixed, unless someone moves the tag. |
| Major version tag | `@v1` | Moves to the latest `v1.x.y` release. |
| Commit SHA | `@8f4b7f8...` | Immutable. Safest for users. |
Semantic versioning and the moving major tag
Use semantic versioning: MAJOR.MINOR.PATCH. Increase PATCH for bug fixes, MINOR for backward-compatible features, and MAJOR for breaking changes. Changing or removing an input, an output, or the required runtime counts as a breaking change.
Most published actions also keep a major tag such as v1. It always points at the newest v1.x.y release. Users who write uses: owner/repo@v1 get fixes and features automatically, but never a breaking change.
Release steps
Before you tag, make sure the committed files are what users will run. For a JavaScript action, that means the bundled output (for example dist/index.js) is committed and action.yml points at it. A tag on a commit without the bundle produces an action that fails with missing module errors.
- Merge your changes into the default branch and confirm the test workflow passes.
- Create an annotated tag for the full version.
- Push the tag.
- Move the major tag to the same commit and force-push only that tag.
git checkout main
git pull
git tag -a v1.1.0 -m "Release v1.1.0"
git push origin v1.1.0
git tag -fa v1 -m "Update v1 to v1.1.0"
git push origin v1 --forceThe -f flag replaces the local v1 tag, and --force replaces it on the remote. Force-pushing is acceptable here because the moving major tag is meant to change. Never move a full version tag such as v1.1.0.
Publishing a GitHub release
A tag alone is enough for uses: to work. A GitHub release adds notes and, for public repositories, an optional listing on the GitHub Marketplace. To create one from the command line with the GitHub CLI:
gh release create v1.1.0 --title "v1.1.0" --notes "Adds the time output. No breaking changes."To list on the Marketplace, the repository must be public and contain a single action.yml at the root. Marketplace listing also requires a unique name in that file.
Common errors
- Forgetting the bundle. Users see
Cannot find moduleat run time. Rebuild, commitdist/, then tag. - Moving a full version tag. Users who pinned it get different code than they reviewed. Create a new patch version instead.
- Breaking changes under the same major. Renaming an input inside
v1breaks everyone on@v1. Releasev2. - Lightweight tags mixed with annotated tags. Use
-aconsistently so tools can read the tag message and date.
Exercise
Your action is at v1.4.2. You add an optional input named retries that defaults to the old behavior. Which tags do you create or move, and why?
Show answer
Create the tag v1.5.0, because adding an optional input is a backward-compatible feature, which is a MINOR bump. Then move the v1 tag to the same commit so users on @v1 receive the feature. Do not move v1.4.2.