planetarypy / pvl

Python implementation of PVL (Parameter Value Language)
BSD 3-Clause "New" or "Revised" License
19 stars 19 forks source link

publish-to-test-pypi.yml runs too much? #77

Closed rbeyer closed 3 years ago

rbeyer commented 3 years ago

Well, I had a fun dive into GitHub actions over the holidays. I am of the opinion that publish-to-test-pypi.yml runs too often, and checks too late.

So it runs when:

on:
  push:
    branches: [ $default-branch ]

So every push to the default branch (currently main). That's as of my new PR, it used to run on every push to any branch. Even so, there can be pushes to the main branch that don't need to trigger a build upload to PyPI.

That's currently handled by this if in the last step:

    - name: Publish distribution to PyPI
      if: startsWith(github.ref, 'refs/tags')

So for every push, it is going to do a pip install, and build a distribution, but then only push if there is a tag. Again, any tag. Not just version update tags, but any tags. Now, at the moment, those are the only tags in the repo, but there could be others, and this might do weird things.

It seems to me that we should refine the on statement, so it only runs this workflow if it gets a version tag. I think that can be done like this:

on:
  push:
    branches: [ $default-branch ]
    tags: 'v*'

assuming we stay vigilant and keep using the "v*" tag pattern.