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

fix: Don't run publishing workflow on tags to avoid errors #45

Merged
merged 2 commits into from
Oct 14, 2020

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Oct 14, 2020

With the old workflow if the publishing workflow was run after a new tag was created

$ bump2version <part>
$ git push origin master --tags

no release would get published to TestPyPI as the workflow that would get kicked off from the push event to master (and so NOT a tag event) would fail the "Verify untagged commits have dev versions" step

- name: Verify untagged commits have dev versions
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
wheel_name=$(find dist/ -iname "*.whl" -printf "%f\n")
if [[ "${wheel_name}" == *"pylhe-0.1.dev"* || "${wheel_name}" != *"dev"* ]]; then
echo "python-build incorrectly named built distribution: ${wheel_name}"
echo "python-build is lacking the history and tags required to determine version number"
echo "intentionally erroring with 'return 1' now"
return 1
fi
echo "python-build named built distribution: ${wheel_name}"

as it would

if: "!startsWith(github.ref, 'refs/tags/')"

but then also "${wheel_name}" != *"dev"* given that it comes from a tag. So nothing gets published.

Similarly, the workflow that would get kicked off from the tag event will just run though but will pass

- name: Publish distribution 📦 to Test PyPI
# every PR will trigger a push event on master, so check the push event is actually coming from master
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'scikit-hep/pylhe'
uses: pypa/[email protected]
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/

as it is has github.ref of 'refs/tags/' and so nothing happens at all.

This PR fixes that by just letting pushes to master publish to TestPyPI and then letting the releases publish to PyPI.

* Don't run publishing workflow on tag events
   - Avoid publishing errors due to 'push' or 'tag' events and checks for tags
* Update pypa/gh-action-pypi-publish action to v1.4.1

@matthewfeickert matthewfeickert added CI Continuous Integration fix labels Oct 14, 2020
@matthewfeickert matthewfeickert self-assigned this Oct 14, 2020
@codecov
Copy link

codecov bot commented Oct 14, 2020

Codecov Report

Merging #45 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #45   +/-   ##
=======================================
  Coverage   31.70%   31.70%           
=======================================
  Files           1        1           
  Lines         164      164           
  Branches       32       32           
=======================================
  Hits           52       52           
  Misses        110      110           
  Partials        2        2           
Flag Coverage Δ
#unittests 31.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd781b7...d1d9c7e. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant