Skip to content

Fix publish workflow: use VersionLabel for version resolution#94

Merged
kzu merged 2 commits intomainfrom
copilot/fix-package-version-error
Feb 16, 2026
Merged

Fix publish workflow: use VersionLabel for version resolution#94
kzu merged 2 commits intomainfrom
copilot/fix-package-version-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

The publish workflow was passing -p:version=${GITHUB_REF##*/v} directly to dotnet build, bypassing the VersionLabel-based version resolution in Directory.Build.props. This left PackageVersion empty, causing NuGetizer to fail with error NG1002.

Changes

  • Add VersionLabel: ${{ github.ref }} to env block
  • Remove -p:version=... from build command

This aligns with the upstream devlooped/oss template and allows Directory.Build.props lines 122-150 to handle version extraction from git refs (e.g., refs/tags/v1.8.1.1Version=1.8.1.1).

  env:
    DOTNET_NOLOGO: true
    Configuration: Release
    PackOnBuild: true
    GeneratePackageOnBuild: true
+   VersionLabel: ${{ github.ref }}
    GH_TOKEN: ${{ secrets.GH_TOKEN }}
    JQVERSION: ${{ github.event.inputs.jq || github.event.release.tag_name }}

  - name: 🙏 build
-   run: dotnet build -m:1 -p:version=${GITHUB_REF##*/v} -bl:build.binlog
+   run: dotnet build -m:1 -bl:build.binlog

All jq-specific customizations (workflow_dispatch, JQVERSION, download step) remain unchanged.

Original prompt

Problem

The publish workflow triggered by a release event fails with:

error NG1002: The 'PackageVersion' property cannot be empty.

See failed run: https://github.com/devlooped/jq/actions/runs/22074406797

Root Cause

The current publish.yml passes -p:version=${GITHUB_REF##*/v} directly on the dotnet build command line (line 47). This bypasses the VersionLabel-based versioning logic in src/Directory.Build.props (lines 122-150), which is responsible for properly setting Version, VersionPrefix, VersionSuffix, and ultimately PackageVersion that NuGetizer requires.

Without VersionLabel being set, the Directory.Build.props version block is skipped entirely, and NuGetizer's PackageVersion ends up empty.

The upstream template at devlooped/oss (https://github.com/devlooped/oss/blob/5da103cfbc1c4f9b5f59cfa698d2afbd744a7525/.github/workflows/publish.yml) handles this correctly by:

  1. Setting VersionLabel: ${{ github.ref }} as an environment variable
  2. Running dotnet build -m:1 -bl:build.binlog without -p:version=...

This lets Directory.Build.props handle version resolution through its VersionLabel logic.

Required Changes

Update .github/workflows/publish.yml to align with the upstream devlooped/oss publish workflow versioning approach:

  1. Add VersionLabel: ${{ github.ref }} to the env: block (alongside the existing env vars)
  2. Change the build step from:
    run: dotnet build -m:1 -p:version=${GITHUB_REF##*/v} -bl:build.binlog
    to:
    run: dotnet build -m:1 -bl:build.binlog

Keep all jq-specific customizations intact, including:

  • The workflow_dispatch trigger with jq input
  • The JQVERSION env variable
  • The ⏬ download step that downloads jq binaries
  • The GH_TOKEN env variable
  • All other steps and configuration specific to this repo

Only the versioning-related changes should be made (adding VersionLabel env and removing -p:version=... from the build command).

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI assigned Copilot and kzu Feb 16, 2026
@kzu kzu marked this pull request as ready for review February 16, 2026 19:15
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
@kzu kzu enabled auto-merge (squash) February 16, 2026 19:16
Copilot AI changed the title [WIP] Fix empty PackageVersion issue in publish workflow Fix publish workflow: use VersionLabel for version resolution Feb 16, 2026
Copilot AI requested a review from kzu February 16, 2026 19:18
@kzu kzu merged commit 4396f7c into main Feb 16, 2026
5 checks passed
@kzu kzu deleted the copilot/fix-package-version-error branch February 16, 2026 19:18
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.

2 participants

Comments