Skip to content

Commit

Permalink
Fix a condition check on PyPI release workflow
Browse files Browse the repository at this point in the history
Summary:
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.

Differential Revision: D24696408

fbshipit-source-id: 40b28124ccbb412fceb0da8784c888e88dc51f2e
  • Loading branch information
horizon-blue authored and facebook-github-bot committed Nov 3, 2020
1 parent b7e4698 commit 2b375db
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 2b375db

Please sign in to comment.