Autofill deploy version from latest git tag #13
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/auto-version-from-tag"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Autofill deploy version from latest git tag
Problem
The "Deploy to Production" workflow's
versioninput always defaulted tov0.1.0, forcing a manual edit on every deploy. Forgetting to change it risked creating a duplicate or stale tag.Solution
Changed the input default to
auto. When left asauto, a new "Resolve version" step fetches all tags, picks the highestv*tag via semver sort, and bumps the patch component (v0.1.5->v0.1.6). A manual version can still be entered and is used verbatim.Changes
default: 'v0.1.0'->default: 'auto',required: true->required: false, description updatedv*tag, bumps patch, validates^v\d+\.\d+\.\d+$, exports to$GITHUB_ENVasVERSION${{ github.event.inputs.version }}->${{ env.VERSION }}(4 substitutions)Behavior
auto(default)v0.2.01.2.3)v0.0.0-> deploys asv0.0.1Failure safety
"Resolve version" runs before "Tag version". On fetch failure, parse error, or validation rejection,
set -eaborts - no tag created, no deploy.Notes
autopre-filled (Forgejo can't render dynamic input defaults); resolved version appears in job log + status banner.Testing
Frontend lint + 267 unit tests pass. Backend tests pass. E2E in Docker passes (same stack as
./gradlew check).The deploy.yml workflow_dispatch input always defaulted to 'v0.1.0', requiring manual edit every time. Now the version defaults to 'auto', which fetches all tags, finds the latest v* tag via semver sort, bumps the patch component, and uses that as the deploy tag. Changes: - deploy.yml input: default changed to 'auto', required → false, description updated to explain both auto and manual modes - Added 'Resolve version' step: fetches tags, bumps latest semver tag by patch, validates output format, exports to $VERSION - 'Tag version' step: substituted ${{ github.event.inputs.version }} → ${{ env.VERSION }} to use the resolved/computed version - 'Print deploy status' step: same substitution - Semver validation guard rejects malformed tags (auto and manual)