|
| 1 | +name: CD |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + pypi: |
| 7 | + name: build and deploy to PyPI |
| 8 | + if: github.repository == 'ACCESS-NRI/access-py-telemetry' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 9 | + runs-on: "ubuntu-latest" |
| 10 | + permissions: |
| 11 | + id-token: write |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout source |
| 15 | + |
| 16 | + |
| 17 | + - name: Set up Python 3.11 |
| 18 | + uses: actions/setup-python@v5 |
| 19 | + with: |
| 20 | + python-version: 3.11 |
| 21 | + |
| 22 | + - name: Install build dependencies |
| 23 | + run: python -m pip install build twine |
| 24 | + |
| 25 | + - name: Build distributions |
| 26 | + shell: bash -l {0} |
| 27 | + run: | |
| 28 | + git clean -xdf |
| 29 | + pyproject-build |
| 30 | +
|
| 31 | + - name: Publish package to PyPI |
| 32 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 33 | + |
| 34 | + conda: |
| 35 | + name: build and deploy to conda |
| 36 | + needs: pypi |
| 37 | + if: always() && needs.pypi.result == 'success' |
| 38 | + runs-on: "ubuntu-latest" |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout source |
| 42 | + |
| 43 | + |
| 44 | + - name: Setup conda environment |
| 45 | + uses: conda-incubator/setup-miniconda@v3 |
| 46 | + with: |
| 47 | + miniconda-version: "latest" |
| 48 | + python-version: 3.11 |
| 49 | + environment-file: .conda/environment.yml |
| 50 | + auto-update-conda: false |
| 51 | + auto-activate-base: false |
| 52 | + show-channel-urls: true |
| 53 | + |
| 54 | + - name: Build and upload the conda package |
| 55 | + |
| 56 | + with: |
| 57 | + meta_yaml_dir: .conda |
| 58 | + python-version: 3.11 |
| 59 | + user: accessnri |
| 60 | + label: main |
| 61 | + token: ${{ secrets.anaconda_token }} |
| 62 | + |
0 commit comments