|
| 1 | +name: CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + release: |
| 10 | + types: [published] |
| 11 | + |
| 12 | +jobs: |
| 13 | + packaging: |
| 14 | + if: github.repository_owner == 'sgkit-dev' |
| 15 | + name: Packaging |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: '3.9' |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + python -m pip install build twine validate-pyproject[all] |
| 26 | + - name: Check and install package |
| 27 | + run: | |
| 28 | + validate-pyproject pyproject.toml |
| 29 | + python -m build |
| 30 | + python -m twine check --strict dist/* |
| 31 | + python -m pip install dist/*.whl |
| 32 | + - name: Check vcf2zarr CLI |
| 33 | + run: | |
| 34 | + vcf2zarr --help |
| 35 | + python -m bio2zarr vcf2zarr --help |
| 36 | + - name: Check vcfpartition CLI |
| 37 | + run: | |
| 38 | + vcfpartition --help |
| 39 | + python -m bio2zarr vcfpartition --help |
| 40 | + - name: Store the distribution packages |
| 41 | + uses: actions/upload-artifact@v3 |
| 42 | + with: |
| 43 | + name: python-package-distributions |
| 44 | + path: dist/ |
| 45 | + |
| 46 | + publish-to-pypi: |
| 47 | + if: github.repository_owner == 'sgkit-dev' && github.event_name == 'release' |
| 48 | + needs: |
| 49 | + - packaging |
| 50 | + runs-on: ubuntu-latest |
| 51 | + |
| 52 | + environment: |
| 53 | + name: pypi |
| 54 | + url: https://pypi.org/p/bio2zarr |
| 55 | + permissions: |
| 56 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/download-artifact@v3 |
| 60 | + with: |
| 61 | + name: python-package-distributions |
| 62 | + path: dist/ |
| 63 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 64 | + |
| 65 | + |
| 66 | + publish-to-testpypi: |
| 67 | + if: github.repository_owner == 'sgkit-dev' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 68 | + needs: |
| 69 | + - packaging |
| 70 | + runs-on: ubuntu-latest |
| 71 | + |
| 72 | + environment: |
| 73 | + name: testpypi |
| 74 | + url: https://test.pypi.org/p/bio2zarr |
| 75 | + |
| 76 | + permissions: |
| 77 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 78 | + |
| 79 | + steps: |
| 80 | + - uses: actions/download-artifact@v3 |
| 81 | + with: |
| 82 | + name: python-package-distributions |
| 83 | + path: dist/ |
| 84 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 85 | + with: |
| 86 | + repository-url: https://test.pypi.org/legacy/ |
0 commit comments