forked from SPARC-X/SPARC-X-API
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.49 KB
/
publish-pypi.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
name: Publish PyPI package
on:
# The workflow runs on each push / PR but only allow upload
# PyPI when tagged
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
publish-pypi:
name: upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.10"
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: sparc-api-test
- name: Install dependencies
run: |
pip install -U build
- name: Download data
run: |
# Download the external psp data
python -m sparc.download_data
# Check if psp8 exists
ls sparc/psp/*.psp8
- name: Build wheel
run: |
# Wheels are inside dist/ folder
python -m build
# Check the contents, if psp exists
TMP_DIR=$(mktemp -d)
unzip dist/sparc_x_api-*.whl -d ${TMP_DIR}
find $TMP_DIR/sparc/psp -name "*.psp8"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')