-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (77 loc) · 2.54 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: openghg_defs workflow
on:
push:
branches: [main, devel]
tags:
- "*"
pull_request:
branches: [main, devel]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install dev requirements
run: |
pip install -r requirements-dev.txt
- name: Install package
run: |
pip install .
- name: Run tests
run: |
pytest .
release_pypi:
name: Build and publish Python distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install pypa/build
run: |
pip install --upgrade build
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
password: ${{ secrets.PYPI_API_TOKEN }}
release_conda:
name: Build and publish conda package
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7
with:
init-shell: bash
- name: Build the conda package
run: |
micromamba create -n openghg_build anaconda-client boa -c conda-forge -y
micromamba activate openghg_build
mkdir ${{ github.workspace }}/build
conda mambabuild --croot ${{ github.workspace }}/build recipes -c conda-forge
BUILD_DIR=${GITHUB_WORKSPACE}/build
BUILD=$(find "$BUILD_DIR" -name '*.tar.bz2')
anaconda --token "$ANACONDA_TOKEN" upload --user openghg "$BUILD"
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}