Skip to content

feat: export version as action outputs#5

Merged
hhvrc merged 2 commits into
masterfrom
feat/export-version-outputs
Jun 25, 2026
Merged

feat: export version as action outputs#5
hhvrc merged 2 commits into
masterfrom
feat/export-version-outputs

Conversation

@hhvrc

@hhvrc hhvrc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Surfaces the version the tool already computes as proper GitHub Action outputs, so consuming workflows can read it directly instead of parsing logs or re-deriving it from git tags.

  • status mode now writes machine-readable step outputs (next-version, previous-version, bump, skip) in addition to its human-readable text. It also now uses the same ComputeNext the release path uses, so the version reported by status can't drift from what release would tag. status has no branch-config dependency, so consumers can read the next version on any branch — including PRs and feature branches not listed in .changes/config.json.
  • release/prerelease now expose a version output (the full computed version string, i.e. the tag without prefix) alongside tag. This makes the version available even on the no-tag path, where tag is empty but the version is known (e.g. 1.6.0-develop+gbb0c825).
  • action.yml declares the new outputs: version, next-version, previous-version, bump.
  • GITHUB_OUTPUT writing is consolidated into a single appendGitHubOutput helper (removes the duplicated open/write/error-handling across the three writers).

Motivation

In OpenShock/Firmware, get-vars.js independently derived the build version from the latest git tag (no bump), while release-tool computed the next version from .changes/. The two diverged (1.5.2-develop+… vs 1.6.0-develop+…), and dev/CI artifacts were labelled as a pre-release of the last release rather than the upcoming one. Exposing the version here lets get-vars consume release-tool as the single source of truth.

Testing

  • go build ./..., go vet ./cmd/..., go test ./... all pass.
  • Smoke-tested status against the Firmware repo: emits next-version=1.6.0, previous-version=1.5.2, bump=minor, skip=false.

Open in Stage

status mode now writes machine-readable step outputs (next-version,
previous-version, bump, skip) instead of only human text, and uses the
same ComputeNext as the release path so the two can't drift. status has
no branch-config dependency, so consumers can read the next version on
any branch (including PRs and feature branches).

release/prerelease now expose a `version` output (the full computed
version) in addition to `tag`, so the version is available even on the
no-tag path where `tag` is empty.

GITHUB_OUTPUT writing is consolidated into a single appendGitHubOutput
helper.
@stage-review

stage-review Bot commented Jun 25, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Consolidate GitHub Output writing logic
2 Expose version outputs in release commands
3 Enhance status mode with machine-readable outputs
4 Declare new outputs in Action metadata
Open in Stage

Chapters generated by Stage for commit ade5978 on Jun 25, 2026 10:14am UTC.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Change file check

OK — 1 valid change file(s) added in this PR.

@hhvrc hhvrc merged commit 60c7aff into master Jun 25, 2026
7 checks passed
@hhvrc hhvrc deleted the feat/export-version-outputs branch June 25, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant