-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 1.94 KB
/
publish-to-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
56
57
58
59
60
61
62
63
64
65
66
67
name: Publish to PyPI
on:
release:
types: [published]
jobs:
pypi:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11']
include:
- os: ubuntu-latest
cc: gcc
cxx: g++
label: linux-64
- os: macos-latest
cc: clang
cxx: clang++
label: osx-64
- os: windows-latest
cc: cl
cxx: cl
label: win-64
name: ${{ matrix.label }}-Python-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry in Conda Environment
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Cache Poetry Env
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: poetry-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
- name: Build and Publish
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.python-version }}" == "3.11" ]]; then
poetry build
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
poetry build -f wheel
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
poetry build -f wheel
fi
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN_PHASEFLOW }}
poetry publish