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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ jobs:
- name: "Build Package"
run: python -m build

- name: "Get release version"
- name: "Get release variables"
run: |
echo ML_WAREHOUSE_PYTHON_VERSION=$(git describe --always --tags --dirty) >> $GITHUB_ENV
echo MAIN_SHA=$(git rev-parse origin/main) >> $GITHUB_ENV

- name: "Create Release"
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.

prerelease: ${{ !(github.sha == env.MAIN_SHA) }}
artifacts: "dist/*.tar.gz"
removeArtifacts: true
artifactErrorsFailBuild: true
Expand Down