ncipollo/release-action

The `make_latest` setting has no effect

Closed this issue · 2 comments

Describe the bug
I have a logic for patching releases, and I would like to prevent some releases from being identified as the latest. My logic is that if the workflow is started from the main branch, then I define it as the latest release, otherwise, it is a patch.

The problem is that when I pass the 'makeLatest' parameter as 'false', my release is still shown as the latest.

Expected behavior
I'd like my release to not have the latest mark when passing 'false' to the 'make_latest' parameter.

To Reproduce
I can reproduce it with the following snippet of the workflow:

- name: Check if latest release
id: latest_release_check
run: |
  if [ "${GITHUB_REF#refs/heads/}" = "main" ]; then
    echo "is_latest_release=true" >> $GITHUB_OUTPUT
  else
    echo "is_latest_release=false" >> $GITHUB_OUTPUT
  fi
- name: Update release
uses: ncipollo/release-action@v1
with:
  artifacts: "xxx-${{ inputs.release_number }}.zip,yyy-${{ inputs.release_number }}.zip"
  bodyFile: "CHANGELOG.md"
  tag: ${{ inputs.release_number }}
  makeLatest: "${{ steps.latest_release_check.outputs.is_latest_release }}"

Workflow logs
Logs show that the parameter was passed correctly. But I still see the release as the latest:

Run ncipollo/release-action@v1
  with:
    artifacts: xxx-0.0.26.zip, yyy-0.0.26.zip
    bodyFile: CHANGELOG.md
    tag: 0.0.26
    makeLatest: false
    generateReleaseNotes: false
    omitBody: false
    omitBodyDuringUpdate: false
    omitDraftDuringUpdate: false
    omitName: false
    omitNameDuringUpdate: false
    omitPrereleaseDuringUpdate: false
    removeArtifacts: false
    replacesArtifacts: true
    skipIfReleaseExists: false
    token: ***
    updateOnlyUnreleased: false

Screenshots
Screenshot 2024-09-05 at 13 45 15

I don't think false will prevent a release which is latest from being marked as such. It just means it will not explicitly be latest (though GitHub docs are vague). You could maybe try "legacy" which would bases latest on semantic version and date.

You could also mark the release as prerelease or draft which would prevent it from being marked as latest.

From the docs:

Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version.
Default: true

https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

Okay, I see. Thx a lot 👍🏽