Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply pre-release label only when the commit shasum does not match main #49

Merged
merged 2 commits into from
Jul 12, 2022

Conversation

mksanger
Copy link
Contributor

@mksanger mksanger commented Jul 7, 2022

Allows releases to be marked as release automatically (rather than prerelease)

@@ -39,7 +39,7 @@ jobs:
uses: ncipollo/release-action@v1.10.0
with:
name: ${{ env.ML_WAREHOUSE_PYTHON_VERSION }}
prerelease: ${{ !(github.ref == 'refs/heads/master') }}
Copy link

@ghost ghost Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure prerelease can ever be false, regardless of it being refs/heads/master or refs/heads/main. From the GitHub Actions Context docs, github.ref won't refer to the branch name when the workflow is triggered by a tag:

The branch or tag ref that triggered the workflow run. For workflows triggered by push, this is the branch or tag ref that was pushed. For workflows triggered by pull_request, this is the pull request merge branch. For workflows triggered by release, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format is refs/heads/<branch_name>, for pull requests it is refs/pull/<pr_number>/merge, and for tags it is refs/tags/<tag_name>. For example, refs/heads/feature-branch-1.

Since the workflow is only triggered by tag, github.ref would always be refs/tags/<tag_name>, making all releases pre-releases.

@mksanger mksanger changed the title Change 'master' to 'main' in create-release github action yml Apply pre-release label only when the commit shasum does not match main Jul 8, 2022
@mksanger
Copy link
Contributor Author

mksanger commented Jul 8, 2022

See https://github.com/mksanger/test_release for a test of the new version

@ghost
Copy link

ghost commented Jul 11, 2022

That works, but it comes with the issue that if you try to tag another commit than the HEAD of main, it'll be marked as a prerelease. That's probably not an issue since we only merge to master on releases anyway, and it shouldn't be hard to change a release type after it being published.

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