Skip to content

Commit 3564d98

Browse files
Add cd workflow with pip & conda deploy, etc. (#27)
* Add cd workflow with pip & conda deploy, etc. * Setup environment.yml and meta.yml for conda deploy.
1 parent 7642eab commit 3564d98

File tree

4 files changed

+114
-322
lines changed

4 files changed

+114
-322
lines changed

.conda/environment.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
channels:
2+
- conda-forge
3+
- accessnri
4+
- default
5+
6+
dependencies:
7+
- anaconda-client
8+
- conda-build
9+
- conda-verify

.conda/meta.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{% set data = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True) %}
2+
{% set version = data.get('version') %}
3+
4+
package:
5+
name: access-py-telemetry
6+
version: "{{ version }}"
7+
8+
source:
9+
url: "https://pypi.io/packages/source/a/access-py-telemetry/access_py_telemetry-{{ version }}.tar.gz"
10+
11+
build:
12+
noarch: python
13+
number: 0
14+
script: "{{ PYTHON }} -m pip install . -vv"
15+
16+
requirements:
17+
host:
18+
- python
19+
- pip
20+
- versioneer
21+
run:
22+
- python >=3.10
23+
- ipython>=7.0.0
24+
- pydantic>=2.0.0
25+
- pyyaml>=6.0.0
26+
- httpx>=0.28.0
27+
28+
about:
29+
home: https://github.com/ACCESS-NRI/access-py-telemetry
30+
license: Apache Software
31+
license_family: APACHE
32+
summary: "Tools to add telemetry data to Python package usage"
33+
# doc_url: https://access-py-telemetry-catalog.readthedocs.io/en/latest/
34+
35+
extra:
36+
recipe-maintainers:
37+
- charles-turner-1

.github/workflows/cd.yml

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

0 commit comments

Comments
 (0)