Skip to content

Add package.json version fallback to release workflow #79

@ScottMorris

Description

@ScottMorris

Context

threshold's release-build.yml has a useful pattern: when triggered via workflow_dispatch without a manual tag, it reads the version from apps/threshold/package.json:

version="$(node -p "require('./apps/threshold/package.json').version")"
echo "tag_name=v$version" >> "$GITHUB_OUTPUT"

This repo's release.yml requires a tag for tag-triggered releases and a manually entered tag for workflow_dispatch. There's no fallback to read the version from package.json.

Proposal

Add a package.json version fallback to the prepare-release job's Resolve release tag step:

if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
  TAG="${{ inputs.release_tag }}"
  if [[ -z "${TAG}" ]]; then
    # Fallback: read version from package.json
    TAG="v$(node -p "require('./package.json').version")"
  fi
fi

This allows maintainers to trigger a release without manually entering a version — the workflow infers it from the source of truth.

Acceptance Criteria

  • workflow_dispatch input release_tag is no longer required (or has a blank default)
  • When left blank, version is read from package.json
  • Tag-triggered releases still work as before
  • Tested with a draft release

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovements or feature refinementsinfrastructureBuild systems, CI/CD, tooling, and shared infrastructure
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions