From 04767a94b1520601cdba1bf2caa0781583764f69 Mon Sep 17 00:00:00 2001 From: mayankpande88 Date: Thu, 10 Sep 2026 20:01:07 +0530 Subject: [PATCH] fix(release): publish prereleases from a draft so assets upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Immutable releases reject asset uploads after publication, and a prerelease is published the moment it is created. The binaries therefore failed to attach on v0.1.7-rc.1, taking the whole release job to a failure even though the image had already been pushed: Cannot upload asset nudgebee-node-agent-0.1.7-rc.1-arm64 to an immutable release. GitHub only allows asset uploads before a release is published, but draft prereleases publish with the release.published event instead of release.prereleased. This is not specific to that tag — every RC would have failed the same way, and RCs are how this repo validates changes before a full release. Prereleases are now created as a draft, which stays writable for the upload, then published in a following step. Full releases are unaffected and stay non-draft, which is why only RCs ever broke. Downstream consumers should watch release.published, which fires for both paths. --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dcfde56..af99be9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,6 +99,26 @@ jobs: # v1.2.3-rc.1 is not. prerelease: ${{ contains(github.ref_name, '-') }} make_latest: ${{ !contains(github.ref_name, '-') }} + # Immutable releases reject asset uploads after publication, and a + # prerelease is published the moment it is created — so uploading the + # binaries failed outright on v0.1.7-rc.1: + # + # Cannot upload asset nudgebee-node-agent-0.1.7-rc.1-arm64 to an + # immutable release. + # + # Creating prereleases as a draft keeps them writable long enough for + # the upload; the next step publishes. Full releases are unaffected + # and stay non-draft, which is why this only ever broke RCs. + draft: ${{ contains(github.ref_name, '-') }} files: | /tmp/nudgebee-node-agent-${{ steps.meta.outputs.version }}-amd64 /tmp/nudgebee-node-agent-${{ steps.meta.outputs.version }}-arm64 + + # Publishing from the draft is what makes the assets stick. Downstream + # consumers should watch release.published, which fires here for both + # prereleases and full releases. + - name: Publish prerelease draft + if: github.event_name == 'push' && contains(github.ref_name, '-') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release edit "${{ github.ref_name }}" --draft=false --repo "${{ github.repository }}"