Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit f67ddd4

Browse files
committed
Add publish to anaconda step
1 parent 7300883 commit f67ddd4

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/code.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,42 @@ jobs:
170170
- name: Test cli works in runtime image
171171
run: docker run ${{ env.IMAGE_REPOSITORY }} --version
172172

173+
conda:
174+
needs: [dist]
175+
runs-on: ubuntu-latest
176+
177+
steps:
178+
- uses: actions/download-artifact@v3
179+
180+
- name: Create Conda recipe
181+
run: |
182+
mkdir -p conda/recipe
183+
pipx run grayskull pypi -o conda/recipe dist/*.tar.gz
184+
185+
- name: Install conda-build
186+
run: conda install -y conda-build
187+
188+
- name: Build Conda distribution
189+
run: |
190+
mkdir -p conda/build
191+
conda build --output-folder conda/build conda/recipe/*/meta.yaml
192+
193+
- name: Upload conda build
194+
uses: actions/upload-artifact@v3
195+
with:
196+
name: conda_build
197+
path: |
198+
conda/build/
199+
!conda/build/*/.cache
200+
173201
release:
174202
# upload to PyPI and make a release on every tag
175-
needs: [lint, dist, test]
203+
needs: [lint, dist, test, conda]
176204
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
177205
runs-on: ubuntu-latest
206+
env:
207+
HAS_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN != '' }}
208+
HAS_ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN != '' }}
178209

179210
steps:
180211
- uses: actions/download-artifact@v3
@@ -197,6 +228,11 @@ jobs:
197228
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198229

199230
- name: Publish to PyPI
231+
if: ${{ env.HAS_PYPI_TOKEN }}
200232
uses: pypa/gh-action-pypi-publish@release/v1
201233
with:
202234
password: ${{ secrets.PYPI_TOKEN }}
235+
236+
- name: Publish to Anaconda
237+
if: ${{ env.HAS_ANACONDA_TOKEN }}
238+
run: pipx run --spec anaconda-client anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload conda_build/noarch/*.tar.bz2

README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
python3-pip-skeleton
22
===========================
33

4-
|code_ci| |docs_ci| |coverage| |pypi_version| |license|
4+
|code_ci| |docs_ci| |coverage| |pypi_version| |anaconda_version| |license|
55

66
.. note::
77

@@ -14,6 +14,7 @@ how it does it, and why people should use it.
1414

1515
============== ==============================================================
1616
PyPI ``pip install python3-pip-skeleton``
17+
Conda ``conda install -c DiamondLightSource python3-pip-skeleton``
1718
Source code https://github.com/DiamondLightSource/python3-pip-skeleton
1819
Documentation https://DiamondLightSource.github.io/python3-pip-skeleton
1920
Releases https://github.com/DiamondLightSource/python3-pip-skeleton/releases
@@ -49,6 +50,10 @@ Or if it is a commandline tool then you might put some example commands here::
4950
:target: https://pypi.org/project/python3-pip-skeleton
5051
:alt: Latest PyPI version
5152

53+
.. |anaconda_version| image:: https://anaconda.org/DiamondLightSource/python3-pip-skeleton/badges/version.svg
54+
:target: https://anaconda.org/DiamondLightSource/python3-pip-skeleton
55+
:alt: Latest Anaconda version
56+
5257
.. |license| image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg
5358
:target: https://opensource.org/licenses/Apache-2.0
5459
:alt: Apache License

0 commit comments

Comments
 (0)