Skip to content

Commit

Permalink
Merge pull request #20 from qua-platform/publish_to_pypi
Browse files Browse the repository at this point in the history
Publish to PyPI
  • Loading branch information
nulinspiratie authored Oct 11, 2024
2 parents 93f6995 + 761963b commit 38be5bc
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 60 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish release to PyPI

on:
release:
types: [ published ]

env:
# make sure the poetry creates the venv inside the workspace under .venv
POETRY_VIRTUALENVS_IN_PROJECT: true

jobs:
build:
name: Publish from release
uses: qua-platform/qualibrate/.github/workflows/reusable-build.yaml@main

release:
name: Release package to PyPi
runs-on: ubuntu-latest
needs:
- build
permissions:
id-token: write
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# This is necessary so that we have the tags.
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: python-package-*

- name: Publish distribution to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: python-package-sdist
pattern: python-package-*
- name: Create release notes
run: |
cat > notes.md <<- EOM
Individual release notes can be found in the respective packages.
Qualibrate App package version:$(ls qualibrate-wheels/qualibrate_app-* | cut -d'-' -f3)
Qualibrate Runner package version:$(ls qualibrate-wheels/qualibrate_runner-* | cut -d'-' -f3)
Qualibrate Core package version:$(ls qualibrate-wheels/qualibrate_core-* | cut -d'-' -f3)
Qualibrate App package version: $(poetry show qualibrate-app | awk '/version/ { print $3 }')
Qualibrate Runner package version: $(poetry show qualibrate-runner | awk '/version/ { print $3 }')
Qualibrate Core package version: $(poetry show qualibrate-core | awk '/version/ { print $3 }')
EOM
- name: Create release
env:
Expand All @@ -35,4 +35,5 @@ jobs:
--notes-file notes.md
--verify-tag --latest
--draft
"dist/qualibrate-${GITHUB_REF_NAME#v}-py3-none-any.whl"
"dist/qualibrate-${GITHUB_REF_NAME#v}.tar.gz"
16 changes: 8 additions & 8 deletions .github/workflows/reusable-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
retention-days: 3
if-no-files-found: error

# - uses: actions/upload-artifact@v4
# id: upload-wheel
# name: Upload wheel
# with:
# name: python-package-wheel
# path: dist/qualibrate-*.whl
# retention-days: 3
# if-no-files-found: error
- uses: actions/upload-artifact@v4
id: upload-wheel
name: Upload wheel
with:
name: python-package-wheel
path: dist/qualibrate-*.whl
retention-days: 3
if-no-files-found: error
77 changes: 41 additions & 36 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ repository = "https://github.com/qua-platform/qualibrate"
packages = [{ include = "qualibrate_composite" }]
readme = "README.md"

include = [
{ path = "qualibrate-wheels/qualibrate_app-0.1.0-py3-none-any.whl", format = ["sdist", "wheel"] },
{ path = "qualibrate-wheels/qualibrate_core-0.1.0-py3-none-any.whl", format = ["sdist", "wheel"] },
{ path = "qualibrate-wheels/qualibrate_runner-0.1.0-py3-none-any.whl", format = ["sdist", "wheel"] },
]

[tool.poetry.dependencies]
python = "^3.9"
pydantic = "^2.7.4"
pydantic-settings = "^2.3.4"
click = "^8.1.7"
tomli = { version = "^2.0.1", python = "<3.11" }
tomli-w = "^1.0.0"
qualibrate-core = {path = "qualibrate-wheels/qualibrate_core-0.1.0-py3-none-any.whl"}
qualibrate-runner = {path = "qualibrate-wheels/qualibrate_runner-0.1.0-py3-none-any.whl"}
qualibrate-app = {path = "qualibrate-wheels/qualibrate_app-0.1.0-py3-none-any.whl"}
qualibrate-core = "^0.2.0"
qualibrate-runner = "^0.2.0"
qualibrate-app = "^0.2.0"

[tool.poetry.group.dev.dependencies]
mypy = "^1.8.0"
Expand Down
1 change: 0 additions & 1 deletion qualibrate-app
Submodule qualibrate-app deleted from bb58d3
1 change: 0 additions & 1 deletion qualibrate-core
Submodule qualibrate-core deleted from 32b3e5
1 change: 0 additions & 1 deletion qualibrate-runner
Submodule qualibrate-runner deleted from f5d9b0

0 comments on commit 38be5bc

Please sign in to comment.