Skip to content

Commit

Permalink
fix: Check if HEAD of origin/master is accessible from latest tag (#888)
Browse files Browse the repository at this point in the history
* Fix wheel version check on push events to origin/master on releases
   - Needed to work with Tag Creator workflow (c.f. PR #884)
   - Fixes deployment of releases to TestPyPI as well
   - Amends PR #884
  • Loading branch information
matthewfeickert authored Jun 1, 2020
1 parent 2b0a1e2 commit 6526c3b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
python-version: 3.7
- name: Install pep517 and twine
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install pep517 --user
python -m pip install twine
- name: Build a binary wheel and a source tarball
Expand All @@ -31,12 +32,19 @@ jobs:
- name: Verify untagged commits have dev versions
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
latest_tag=$(git describe --tags)
latest_tag_revlist_SHA=$(git rev-list -n 1 ${latest_tag})
master_SHA="$(git rev-parse --verify origin/master)"
wheel_name=$(find dist/ -iname "*.whl" -printf "%f\n")
if [[ "${wheel_name}" == *"pyhf-0.1.dev"* || "${wheel_name}" != *"dev"* ]]; then
echo "pep517.build incorrectly named built distribution: ${wheel_name}"
echo "pep517 is lacking the history and tags required to determine version number"
echo "intentionally erroring with 'return 1' now"
return 1
if [[ "${latest_tag_revlist_SHA}" != "${master_SHA}" ]]; then # don't check master push events coming from tags
if [[ "${wheel_name}" == *"pyhf-0.1.dev"* || "${wheel_name}" != *"dev"* ]]; then
echo "pep517.build incorrectly named built distribution: ${wheel_name}"
echo "pep517 is lacking the history and tags required to determine version number"
echo "intentionally erroring with 'return 1' now"
return 1
fi
else
echo "Push event to origin/master was triggered by push of tag ${latest_tag}"
fi
echo "pep517.build named built distribution: ${wheel_name}"
- name: Verify tagged commits don't have dev versions
Expand Down

0 comments on commit 6526c3b

Please sign in to comment.