Skip to content

Commit

Permalink
add CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dougiesquire committed May 16, 2023
1 parent 072b43c commit a9208e0
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .conda/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
channels:
- conda-forge
- default

dependencies:
- anaconda-client
- conda-build
- conda-verify
39 changes: 39 additions & 0 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 63 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit a9208e0

Please sign in to comment.