From fc891c4d55e1cb8aebfaef39cea665e48cd2f5dd Mon Sep 17 00:00:00 2001 From: Mattia Almansi Date: Fri, 20 Oct 2023 13:10:22 +0200 Subject: [PATCH] template update --- .cruft.json | 2 +- .github/workflows/on-push.yml | 78 +++++++++++++++++++---------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/.cruft.json b/.cruft.json index eb58315..0249711 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/ecmwf-projects/cookiecutter-conda-package", - "commit": "22b85d3aca63d05f4a19f1a531bcea311617f4cd", + "commit": "2efb5584faa681782a41bf2bb437295c5c0f4045", "checkout": null, "context": { "cookiecutter": { diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 4540378..9ae0292 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -35,14 +35,13 @@ jobs: - uses: actions/checkout@v4 - name: Install conda-merge run: | - $CONDA/bin/python -m pip install conda-merge + python -m pip install conda-merge - name: Combine environments run: | for SUFFIX in ci integration; do - $CONDA/bin/conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit + conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit done - - name: Archive combined environments - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: combined-environments path: ci/combined-environment-*.yml @@ -57,13 +56,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download combined environments - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v3 with: name: combined-environments path: ci - - name: Install Conda environment with Micromamba - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: ci/combined-environment-ci.yml environment-name: DEVELOP @@ -83,13 +80,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download combined environments - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v3 with: name: combined-environments path: ci - - name: Install Conda environment with Micromamba - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: ci/combined-environment-ci.yml environment-name: DEVELOP @@ -109,13 +104,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download combined environments - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v3 with: name: combined-environments path: ci - - name: Install Conda environment with Micromamba - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: ci/combined-environment-ci.yml environment-name: DEVELOP @@ -145,13 +138,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download combined environments - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v3 with: name: combined-environments path: ci - - name: Install Conda environment with Micromamba - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: ci/combined-environment${{ matrix.extra }}.yml environment-name: DEVELOP${{ matrix.extra }} @@ -168,11 +159,6 @@ jobs: distribution: runs-on: ubuntu-latest needs: [unit-tests, type-check, docs-build, integration-tests] - environment: - name: pypi - url: https://pypi.org/p/cacholote - permissions: - id-token: write # IMPORTANT: this permission is mandatory for trusted publish if: | always() && needs.unit-tests.result == 'success' && @@ -182,18 +168,40 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install packages + - name: Install package run: | - $CONDA/bin/python -m pip install build twine - - name: Build distributions + python -m pip install --upgrade pip + python -m pip install build twine + - name: Build distribution run: | - $CONDA/bin/python -m build + python -m build - name: Check wheels run: | cd dist || exit - $CONDA/bin/python -m pip install cacholote*.whl || exit - $CONDA/bin/python -m twine check * || exit - $CONDA/bin/python -c "import cacholote" - - name: Publish a Python distribution to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 + python -m pip install cacholote*.whl || exit + python -m twine check --strict * || exit + python -c "import cacholote" || exit + cd .. + - uses: actions/upload-artifact@v3 + with: + name: distribution + path: dist + + upload-to-pypi: + runs-on: ubuntu-latest + needs: distribution + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + environment: + name: pypi + url: https://pypi.org/p/cacholote + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publish + + steps: + - uses: actions/download-artifact@v3 + with: + name: distribution + path: dist + - uses: pypa/gh-action-pypi-publish@v1.8.10 + with: + verbose: true