Skip to content

Commit

Permalink
Fix a condition check on PyPI release workflow (#52)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #52

1. There was a small bug in the PyPI release workflow where I accidentally inverted the true/false condition on whether a new version should be released or not.
2. However, (1) means that the workflow should've been triggered. The only reason it wasn't is that, by default, the `checkout` action only pull the latest commit without any history... [so using `git tag` in workflow does not return anything](actions/checkout#100)
3. To fix (2), we should use `git ls-remote` to check the existing tags on GitHub (instead of listing the local ones). Cloning the repo with full history also works, but is much less efficient.

Reviewed By: nimar

Differential Revision: D24696408

fbshipit-source-id: f0834187672acf28eabd06466b519405f487fc52
  • Loading branch information
horizon-blue authored and facebook-github-bot committed Nov 3, 2020
1 parent 4dd785d commit 44b0632
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ jobs:
id: version
run: |
VERSION_TAG="v$(python setup.py --version)"
if [[ $(git tag -l $VERSION_TAG) ]]; then
echo "::set-output name=has_updated::true"
else
if [[ $(git ls-remote --tags origin refs/tags/$VERSION_TAG) ]]; then
# there exists a tag with same name as current version
echo "::set-output name=has_updated::false"
else
echo "::set-output name=has_updated::true"
fi
echo "::set-output name=version_tag::$(echo $VERSION_TAG)"
echo "The current version of PPL Bench is $VERSION_TAG"
Expand Down

0 comments on commit 44b0632

Please sign in to comment.