Skip to content

Move release job to build workflow to release only after full tests #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,68 @@ jobs:
with:
branch: gh-pages
folder: dist

publish-pypi:
name: Publish to PyPI
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
pip install wheel .[tests]
- name: run tests
run: pytest --disable-pytest-warnings

- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT

- name: Detect new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/[email protected]
with:
create-tag: false
version-command: |
bash -o pipefail -c "cat bioimageio/core/VERSION | jq -r '.version'"

- name: Push tag
id: tag-version
if: steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.check-version.outputs.current-version }}

- name: Build package
run: |
python setup.py sdist bdist_wheel

- name: Publish package on PyPI
if: steps.tag-version.outputs.new_tag
uses: pypa/gh-action-pypi-publish@release/v1.10
with:
user: __token__
password: "${{ secrets.PYPI_TOKEN }}"
packages-dir: dist/
verbose: true
- name: Publish the release notes
uses: release-drafter/[email protected]
with:
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
tag: "${{ steps.tag-version.outputs.new_tag }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
75 changes: 0 additions & 75 deletions .github/workflows/release.yml

This file was deleted.

5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
),
"tensorflow": ["tensorflow", "keras>=2.15,<4"],
"onnx": ["onnxruntime"],
"tests": (test_deps := ["pytest"]), # minimal test requirements
"dev": (
pytorch_deps
test_deps
+ pytorch_deps
+ [
"black",
"cellpose", # for model testing
Expand All @@ -67,7 +69,6 @@
"pre-commit",
"pyright==1.1.396",
"pytest-cov",
"pytest",
"segment-anything", # for model testing
"timm", # for model testing
# "crick", # currently requires python<=3.9
Expand Down
Loading