Reputation: 15623
I have a Github Action that builds Windows wheels. At the end of the build it installs the wheels to make sure everything's OK, but right now the version is hard coded in the filename. I saw this question that deals with releases, but I'd like to run this on every push to master to check that things are OK.
Right now there's a line in my action looks like this:
pip install "fugashi-0.1.9rc1-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
I don't want to have to update the action every time the version changes, so I would like the line to look like this:
pip install "fugashi-$VERSION-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
But I do not know how to get the version into the environment of the github action.
Is there some way I can get the version number from setup.py in an environment variable for the job?
Upvotes: 5
Views: 2217
Reputation: 15623
This ended up being much simpler than I thought. You can just get the version from setup.py itself and use that.
VERSION=$(python setup.py --version)
pip install "dist/fugashi-$VERSION-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
Trying to change the Github Action environment was a distraction.
Upvotes: 6