Autofill deploy version from latest git tag #13

Merged
jocke merged 1 commit from feature/auto-version-from-tag into develop 2026-06-17 13:44:28 +00:00
Owner

Autofill deploy version from latest git tag

Problem

The "Deploy to Production" workflow's version input always defaulted to v0.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 as auto, a new "Resolve version" step fetches all tags, picks the highest v* 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

  • Input block: default: 'v0.1.0' -> default: 'auto', required: true -> required: false, description updated
  • New "Resolve version" step: fetches tags, finds latest v* tag, bumps patch, validates ^v\d+\.\d+\.\d+$, exports to $GITHUB_ENV as VERSION
  • "Tag version" step: ${{ github.event.inputs.version }} -> ${{ env.VERSION }} (4 substitutions)
  • "Print deploy status" step: same substitution

Behavior

Input Result
auto (default) Fetches tags, bumps latest by patch, logs resolution
Manual v0.2.0 Used verbatim
Malformed (e.g. 1.2.3) Semver guard fails job before any tag pushed
No tags exist Falls back to v0.0.0 -> deploys as v0.0.1

Failure safety

"Resolve version" runs before "Tag version". On fetch failure, parse error, or validation rejection, set -e aborts - no tag created, no deploy.

Notes

  • UI still shows auto pre-filled (Forgejo can't render dynamic input defaults); resolved version appears in job log + status banner.
  • No race guard (per discussion): colliding tag is deleted + re-pushed, same as today's manual behavior.

Testing

Frontend lint + 267 unit tests pass. Backend tests pass. E2E in Docker passes (same stack as ./gradlew check).

## Autofill deploy version from latest git tag ### Problem The "Deploy to Production" workflow's `version` input always defaulted to `v0.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 as `auto`, a new "Resolve version" step fetches all tags, picks the highest `v*` 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 - **Input block**: `default: 'v0.1.0'` -> `default: 'auto'`, `required: true` -> `required: false`, description updated - **New "Resolve version" step**: fetches tags, finds latest `v*` tag, bumps patch, validates `^v\d+\.\d+\.\d+$`, exports to `$GITHUB_ENV` as `VERSION` - **"Tag version" step**: `${{ github.event.inputs.version }}` -> `${{ env.VERSION }}` (4 substitutions) - **"Print deploy status" step**: same substitution ### Behavior | Input | Result | |---|---| | `auto` (default) | Fetches tags, bumps latest by patch, logs resolution | | Manual `v0.2.0` | Used verbatim | | Malformed (e.g. `1.2.3`) | Semver guard fails job before any tag pushed | | No tags exist | Falls back to `v0.0.0` -> deploys as `v0.0.1` | ### Failure safety "Resolve version" runs before "Tag version". On fetch failure, parse error, or validation rejection, `set -e` aborts - no tag created, no deploy. ### Notes - UI still shows `auto` pre-filled (Forgejo can't render dynamic input defaults); resolved version appears in job log + status banner. - No race guard (per discussion): colliding tag is deleted + re-pushed, same as today's manual behavior. ### Testing Frontend lint + 267 unit tests pass. Backend tests pass. E2E in Docker passes (same stack as `./gradlew check`).
jocke added 1 commit 2026-06-17 13:21:36 +00:00
Autofill deploy version from latest git tag instead of hardcoded v0.1.0
All checks were successful
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m6s
CI / E2E browser tests (pull_request) Successful in 3m20s
9a63ff69e7
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)
jocke merged commit f60af7237e into develop 2026-06-17 13:44:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jocke/bilhej#13
No description provided.