88 lines (76 loc) · 2.45 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
79
80
81
82
83
84
85
86
87
88
name: Upload Python Package to PYPI
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
checks: write
actions: read
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.11
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: |
conda config --set always_yes yes --set changeps1 no
mamba install -q -n pypi blas-devel \
fftw \
meson-python \
numpy \
pkg-config \
setuptools_scm \
jupyter \
build \
twine
mamba list -n pypi
- name: Build
shell: bash -l {0}
run: |
mamba env list
python -m build -s
- name: Upload release to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
- 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@v2
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.4.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["${{ steps.download-tarball.outputs.file-path }}"]'