Skip to content

fix(workflows): force-push the release tag on nuget publish - #1406

Merged
harshithmohan merged 1 commit into
ShokoAnime:masterfrom
Foowy:fix/publish-nuget-tag-force-push
Aug 16, 2026
Merged

harshithmohan merged 1 commit into
ShokoAnime:masterfrom
Foowy:fix/publish-nuget-tag-force-push

Conversation

@Foowy

@Foowy Foowy commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

ShokoAnime#1405's tag_exists_error: false never took effect: action-create-tag's
existence check is git tag -l, a local check, but the daily-build
runner does a fresh checkout with no tags fetched — it always sees
'not exists' locally and tries to create+push the tag fresh, which the
remote then rejects since the tag is already there. force_push_tag
force-pushes unconditionally, which is a no-op when the tag already
points at the same commit.
@harshithmohan
harshithmohan merged commit c1f54ee into ShokoAnime:master Aug 16, 2026
3 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@Foowy
Foowy deleted the fix/publish-nuget-tag-force-push branch August 16, 2026 09:41
Foowy added a commit to Foowy/ShokoServer that referenced this pull request Aug 16, 2026
…fy remote tag state

Follow-up to ShokoAnime#1406. Thanks to revam for flagging that force_push_tag: true
works but does so blindly, with no comparison against what the remote tag
currently points to — since this repo's checkout intentionally doesn't fetch
tag history, there was no way to detect a release tag pointing at an
unexpected commit before overwriting it.

Two fixes:

- Replace the rickstaa/action-create-tag step with inline git ls-remote
  logic: query the remote tag directly (a lightweight network call, no
  history fetch) and only skip/create the tag when the remote either
  doesn't have it yet or already points at the exact commit being
  published. Fail loudly instead of overwriting if it points anywhere
  else.

- Restore 1:1 parity with the archived brandedoutcast/publish-nuget
  action, which ShokoAnime#1401 didn't actually achieve: that action queried
  NuGet.org's own version index up front and skipped pack/push/tag
  entirely for an already-published version, so an unchanged-version day
  was a silent no-op. The composite action always ran pack/push/tag
  unconditionally and relied only on --skip-duplicate to no-op the
  package push, while the tag step still ran every time regardless —
  that decoupling is the actual root cause of the Shoko.Abstractions
  tag conflict across ShokoAnime#1401/ShokoAnime#1405/ShokoAnime#1406. Added a "Check if version is
  already published" step that queries NuGet.org's flat-container index
  and gates Pack/Push/Tag on the version being genuinely new.

Verified the git ls-remote logic against three simulated cases on a local
checkout replicating CI's shallow, tags-excluded actions/checkout@v7
default (new tag, idempotent same-commit rerun, tag pointing at a
different commit), and the NuGet.org version-check logic against real
data (existing package+version, nonexistent version, nonexistent
package/404).
Foowy added a commit to Foowy/ShokoServer that referenced this pull request Aug 16, 2026
…fy remote tag state

Follow-up to ShokoAnime#1406. Thanks to revam for flagging that force_push_tag: true
works but does so blindly, with no comparison against what the remote tag
currently points to — since this repo's checkout intentionally doesn't fetch
tag history, there was no way to detect a release tag pointing at an
unexpected commit before overwriting it.

Two fixes, both additive to the existing rickstaa/action-create-tag step
rather than replacing it:

- A "Check remote tag state" step runs git ls-remote before the tag step
  (a lightweight network call, not a history fetch) and only lets the tag
  step run when the remote either doesn't have the tag yet or already
  points at the exact commit being published. If it points anywhere else,
  the job fails loudly instead of the tag step force-overwriting it.

- Restore 1:1 parity with the archived brandedoutcast/publish-nuget
  action, which ShokoAnime#1401 didn't actually achieve: that action queried
  NuGet.org's own version index up front and skipped pack/push/tag
  entirely for an already-published version, so an unchanged-version day
  was a silent no-op. The composite action always ran pack/push/tag
  unconditionally and relied only on --skip-duplicate to no-op the
  package push, while the tag step still ran every time regardless —
  that decoupling is the actual root cause of the Shoko.Abstractions
  tag conflict across ShokoAnime#1401/ShokoAnime#1405/ShokoAnime#1406. Added a "Check if version is
  already published" step that queries NuGet.org's flat-container index
  and gates Pack/Push/Tag on the version being genuinely new.

Verified the git ls-remote logic against three simulated cases on a local
checkout replicating CI's shallow, tags-excluded actions/checkout@v7
default (new tag, idempotent same-commit rerun, tag pointing at a
different commit), and the NuGet.org version-check logic against real
data (existing package+version, nonexistent version, nonexistent
package/404).
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