Skip to content

Commit

Permalink
release.yml: Make VERSION_NUMBER more explicit
Browse files Browse the repository at this point in the history
* Stop repeating version number
* Use || to make fallback case more explicit
  • Loading branch information
joshuacwnewton committed Jun 3, 2022
1 parent 7394563 commit a72262e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
# test publishing just for this PR
pull_request:

# In the workflow_dispatch case, make a new tag from the given input; in the published release case,
# the first variable will be empty, and so this will fall back to using the release's tag.
env:
VERSION_NUMBER: ${{ github.event.inputs.version || github.event.release.tag_name || '2.0.4' }} # TODO: Remove 2.0.4

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -28,8 +33,7 @@ jobs:
if: ${{ github.event.repository.name }} == "data-template"
run: perl -pi -e 's/\${dataset_name}/template/' setup.py
- name: Replace version string in `setup.py`
# TODO: Replace 2.0.3 with ${{ github.event.inputs.version }}
run: perl -pi -e 's/version="dev"/version="2.0.3"/' setup.py
run: perl -pi -e 's/version="dev"/version="$VERSION_NUMBER"/' setup.py
- name: Build
run: |
python -m build --wheel --sdist
Expand All @@ -38,7 +42,7 @@ jobs:
with:
files: 'dist/*'
fail_on_unmatched_files: true
tag_name: 2.0.3 # ${{ github.event.inputs.version }} # in the workflow_dispatch case, make a new tag from the given input; in the published release case, this will be empty and will fall back to updating that release.
tag_name: $VERSION_NUMBER
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
Expand Down

0 comments on commit a72262e

Please sign in to comment.