Skip to content

Commit

Permalink
Add build number to test publish package version
Browse files Browse the repository at this point in the history
Fix test publish workflow failing by trying to re-publish artifacts
with the same version as already published.

Add github.run_id as the package dev version.
  • Loading branch information
phyrwork committed Aug 29, 2024
1 parent 0c4018b commit d38016d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/test-publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ jobs:
python -m pip install --upgrade pip
pip install build
- name: Add build number to package version
shell: python
run: |
import toml
with open("pyproject.toml", "r") as f:
data = toml.load(f)
data["project"]["version"] = f"{data["project"]["version"]}.dev${{ github.run_id }}"
with open("pyproject.toml", "w") as f:
toml.dump(data, f)
- name: Build package
run: python -m build

Expand All @@ -34,3 +47,4 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "copyright2"
version = "0.1.0"
version = "0.1.1"
description = "Text file copyright notice linter and updater."
authors = [{name = "Connor Newton", email = "connor@ifthenelse.io" }]
readme = "README.md"
Expand Down

0 comments on commit d38016d

Please sign in to comment.