78 lines (67 loc) · 2.39 KB
/
pypi_publish.yml
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
name: Upload Python Package to PYPI
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
mamba-version: "*"
channels: conda-forge
channel-priority: strict
auto-update-conda: true
miniconda-version: "latest"
activate-environment: pypi
- name: Set up Conda environment
shell: bash -l {0}
run: |
mamba config --set always_yes yes --set changeps1 no
mamba install -q -n pypi fftw \
liblapack \
openblas \
numpy \
setuptools \
pypandoc \
versioneer \
twine
mamba list -n pypi
- name: Build and publish
env:
# PYPI repository
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# PYPITEST repository
# TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
# TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
shell: bash -l {0}
run: |
mamba env list
python setup.py sdist
twine upload dist/*
- name: Trigger a build on the SHTOOLS/build-shtools repo
run: |
curl -X POST \
https://api.github.com/repos/SHTOOLS/build-shtools/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "New pyshtools release", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- name: Download tarball archive
uses: carlosperate/download-file-action@v1.1.1
id: download-tarball
with:
file-url: 'https://github.com/SHTOOLS/SHTOOLS/archive/${{ env.RELEASE_VERSION }}.tar.gz'
- name: Upload tarball as release asset
uses: alexellis/upload-assets@0.3.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["${{ steps.download-tarball.outputs.file-path }}"]'