Skip to content

Commit

Permalink
cleanup and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
schuenke committed Oct 10, 2024
1 parent 8c038f3 commit 8433c6c
Showing 1 changed file with 56 additions and 11 deletions.
67 changes: 56 additions & 11 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@ jobs:
with:
python-version: "3.x"

- name: Set MRPROVERSIONSUFFIX
id: set_version_suffix
- name: Set environment variable for version suffix
run: echo "MRPROVERSIONSUFFIX=.pre$(date +%s)" >> $GITHUB_ENV

- name: Build package with current timestamp
- name: Build package with version suffix
run: |
echo $MRPROVERSIONSUFFIX
python -m pip install --upgrade build
python -m build
- name: Store the TestPyPi distribution package
- name: Store TestPyPi distribution
uses: actions/upload-artifact@v4
with:
name: testpypi-package-distribution
path: dist/

testpypi-deployment:
name: TestPyPI Deployment
name: Deploy to TestPyPI
needs:
- build-testpypi-package
runs-on: ubuntu-latest
Expand All @@ -48,7 +46,7 @@ jobs:
id-token: write

steps:
- name: Download the TestPyPi distribution package
- name: Download TestPyPi distribution
uses: actions/download-artifact@v4
with:
name: testpypi-package-distribution
Expand All @@ -75,12 +73,46 @@ jobs:
run: |
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ mrpro
- name: Verify MRpro version
run: |
python -c "
import mrpro
import os
version = mrpro.__version__
suffix = os.getenv('MRPROVERSIONSUFFIX')
assert suffix in version, f'Expected {suffix} not found in current version: {version}'
"
build-pypi-package:
name: Build package for PyPI
runs-on: ubuntu-latest
needs:
- test-install-from-testpypi
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build package
run: |
python -m pip install --upgrade build
python -m build
- name: Store PyPi distribution
uses: actions/upload-artifact@v4
with:
name: pypi-package-distribution
path: dist/

pypi-deployment:
name: PyPI Deployment
name: Deploy to PyPI
needs:
- test-install-from-testpypi
runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'

environment:
name: pypi
Expand All @@ -90,5 +122,18 @@ jobs:
id-token: write

steps:
- name: dummy
run: echo "PyPi Deployment is not yet implemented"
- name: Download PyPi distribution
uses: actions/download-artifact@v4
with:
name: pypi-package-distribution
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.ref == 'refs/heads/main'
with:
repository-url: https://test.pypi.org/legacy/
verbose: true

- name: Success message
run: echo "reached end of the script"

0 comments on commit 8433c6c

Please sign in to comment.