From 05635b0a790b7d0bdab9a4f99dfe500e7e9ca11c Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 13:53:44 -0400 Subject: [PATCH 1/9] Write build workflow --- .github/workflows/package.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..6bafb6b --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,28 @@ +name: Python Package + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install Python dependencies + run: | + pip3 install build + - name: Build a binary and a source tarball + run: | + python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ \ No newline at end of file From ee8440a92b09c86a624834f25fc045429afcf5b1 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:02:44 -0400 Subject: [PATCH 2/9] Write release job --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3157624 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + package: + name: Package + uses: ./.github/workflows.package.yml + + release: + name: Release + needs: [package] + runs-on: ubuntu-latest + + environment: pypi + + permissions: + contents: write + id-token: write + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + - name: Upload release assets + uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2 + with: + files: dist/*.whl + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 From 9c9801103e2e164d86b7cbf88198a2d8b7660e68 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:05:07 -0400 Subject: [PATCH 3/9] Testing --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3157624..a7e1386 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: Release -on: - release: - types: [published] +on: [push] +# release: +# types: [published] permissions: contents: read From ba9710848115f7100f094bb521cb454726de77bd Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:13:28 -0400 Subject: [PATCH 4/9] More testing --- .github/workflows/release.yml | 13 +++++-------- pyproject.toml | 2 +- src/shr_parser/version.py | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7e1386..8551c9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,9 @@ jobs: needs: [package] runs-on: ubuntu-latest - environment: pypi + environment: + name: pypi + url: https://test.pypi.org/project/py-shr-parser-tomschmitz/ permissions: contents: write @@ -30,10 +32,5 @@ jobs: name: python-package-distributions path: dist/ - - name: Upload release assets - uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2 - with: - files: dist/*.whl - - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 + - name: Publish Package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 6cf0bd0..6d22f82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" where = ["src"] [project] -name = "py-shr-parser" +name = "py-shr-parser-tomschmitz" version = "1.0.0" authors = [ { name = "Tom Schmitz", email="tschmitz@andrew.cmu.edu" }, diff --git a/src/shr_parser/version.py b/src/shr_parser/version.py index 0feb90d..32d99a2 100644 --- a/src/shr_parser/version.py +++ b/src/shr_parser/version.py @@ -1,3 +1,3 @@ import importlib.metadata -__version__ = importlib.metadata.version("py-shr-parser") +__version__ = importlib.metadata.version("py-shr-parser-tomschmitz") From 5cd30e329d39dc20bd24bc2c67d232b260ad763d Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:15:44 -0400 Subject: [PATCH 5/9] Fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8551c9c..71b83ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ permissions: jobs: package: name: Package - uses: ./.github/workflows.package.yml + uses: ./.github/workflows/package.yml release: name: Release From c0c75da4cc72500012d86e9d2922b212a71ccc71 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:17:00 -0400 Subject: [PATCH 6/9] Update package workflow --- .github/workflows/package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 6bafb6b..84621b8 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,6 +1,6 @@ name: Python Package -on: [push, pull_request] +on: [push, pull_request, workflow_call] permissions: contents: read From 313894a34862b4a77673df5d5ee01af70359a007 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:37:14 -0400 Subject: [PATCH 7/9] I hate workflows --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71b83ed..280548e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,6 @@ jobs: url: https://test.pypi.org/project/py-shr-parser-tomschmitz/ permissions: - contents: write id-token: write steps: From 345a451855bbbffc85fb7e1fbf7452256abdedd6 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:41:34 -0400 Subject: [PATCH 8/9] This crap better work --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 280548e..7b11c9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,3 +33,5 @@ jobs: - name: Publish Package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ From cc521446a3c49cfd8b6f28fb30db2b30706bb2d3 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 14:48:27 -0400 Subject: [PATCH 9/9] Got workflows working --- .github/workflows/package.yml | 2 +- .github/workflows/release.yml | 8 ++------ pyproject.toml | 2 +- src/shr_parser/version.py | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 84621b8..484b773 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,6 +1,6 @@ name: Python Package -on: [push, pull_request, workflow_call] +on: [workflow_call] permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b11c9f..d20685d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,6 @@ name: Release -on: [push] -# release: -# types: [published] +on: [release] permissions: contents: read @@ -19,7 +17,7 @@ jobs: environment: name: pypi - url: https://test.pypi.org/project/py-shr-parser-tomschmitz/ + url: https://pypi.org/project/py-shr-parser/ permissions: id-token: write @@ -33,5 +31,3 @@ jobs: - name: Publish Package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ diff --git a/pyproject.toml b/pyproject.toml index 6d22f82..6cf0bd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" where = ["src"] [project] -name = "py-shr-parser-tomschmitz" +name = "py-shr-parser" version = "1.0.0" authors = [ { name = "Tom Schmitz", email="tschmitz@andrew.cmu.edu" }, diff --git a/src/shr_parser/version.py b/src/shr_parser/version.py index 32d99a2..0feb90d 100644 --- a/src/shr_parser/version.py +++ b/src/shr_parser/version.py @@ -1,3 +1,3 @@ import importlib.metadata -__version__ = importlib.metadata.version("py-shr-parser-tomschmitz") +__version__ = importlib.metadata.version("py-shr-parser")