From a9208e00584f4bc1345fc5197665708d4467df33 Mon Sep 17 00:00:00 2001 From: dougiesquire Date: Tue, 16 May 2023 11:48:51 +1000 Subject: [PATCH] add CD workflow --- .conda/environment.yaml | 8 +++++ .conda/meta.yaml | 39 +++++++++++++++++++++++++ .github/workflows/cd.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 .conda/environment.yaml create mode 100644 .conda/meta.yaml create mode 100644 .github/workflows/cd.yml diff --git a/.conda/environment.yaml b/.conda/environment.yaml new file mode 100644 index 00000000..d15ef240 --- /dev/null +++ b/.conda/environment.yaml @@ -0,0 +1,8 @@ +channels: + - conda-forge + - default + +dependencies: + - anaconda-client + - conda-build + - conda-verify diff --git a/.conda/meta.yaml b/.conda/meta.yaml new file mode 100644 index 00000000..be3a4279 --- /dev/null +++ b/.conda/meta.yaml @@ -0,0 +1,39 @@ +{% set data = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True) %} +{% set version = data.get('version') %} + +package: + name: access-nri-intake + version: "{{ version }}" + +source: + url: "https://pypi.io/packages/source/a/access-nri-intake/access_nri_intake-{{ version }}.tar.gz" + +build: + noarch: python + number: 0 + script: "{{ PYTHON }} -m pip install . -vv" + +requirements: + host: + - python + - pip + - versioneer + run: + - python >=3.9 +# - intake +# - pandas + +test: + imports: + - access_nri_intake + +about: + home: https://github.com/ACCESS-NRI/access-nri-intake-catalog + license: Apache Software + license_family: APACHE + summary: "Tools and configuration info used to manage ACCESS-NRI's intake catalogue" + doc_url: https://access-nri-intake-catalog.readthedocs.io/en/latest/ + +extra: + recipe-maintainers: + - dougiesquire diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..9a062442 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,63 @@ +name: CD + +on: [push, pull_request] + +jobs: + pypi: + name: build and deploy to PyPI + if: github.repository == 'ACCESS-NRI/access-nri-intake-catalog' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + runs-on: "ubuntu-latest" + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install build dependencies + run: python -m pip install build twine + + - name: Build distributions + shell: bash -l {0} + run: | + git clean -xdf + pyproject-build + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.pypi_password }} + + conda: + name: build and deploy to conda + needs: pypi + if: always() && needs.pypi.result == 'success' + runs-on: "ubuntu-latest" + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Setup conda environment + uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + python-version: 3.11 + environment-file: .conda/environment.yml + auto-update-conda: false + auto-activate-base: false + show-channel-urls: true + + - name: Build and upload the conda package + uses: uibcdf/action-build-and-upload-conda-packages@v1.2.0 + with: + meta_yaml_dir: .conda + python-version: 3.11 + user: accessnri + label: main + token: ${{ secrets.anaconda_token }} +