forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (83 loc) · 2.91 KB
/
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
# Only deploy if we're the result of a PR being merged
push:
workflow_dispatch:
branches:
- master
tags:
# Semantic versioning tags
- 'v[0-9]+.[0-9]+.[0-9]+'
# Date style tags
- 'v[0-9]{2}.[0-9]{2}'
jobs:
deploy:
name: Build and publish ${{ matrix.package }} 🐍
runs-on: ubuntu-20.04
timeout-minutes: 120
strategy:
fail-fast: true
matrix:
include:
- PACKAGE: pyln-client
WORKDIR: contrib/pyln-client
- PACKAGE: pyln-testing
WORKDIR: contrib/pyln-testing
- PACKAGE: pyln-proto
WORKDIR: contrib/pyln-proto
- PACKAGE: pyln-grpc-proto
WORKDIR: contrib/pyln-grpc-proto
# Bolt packages are handled differently
#- PACKAGE: pyn-bolt1
# WORKDIR: contrib/pyln-spec/bolt1/
#- PACKAGE: pyn-bolt2
# WORKDIR: contrib/pyln-spec/bolt2/
#- PACKAGE: pyn-bolt4
# WORKDIR: contrib/pyln-spec/bolt4/
#- PACKAGE: pyn-bolt7
# WORKDIR: contrib/pyln-spec/bolt7/
steps:
- uses: actions/checkout@master
with:
# Need to fetch entire history in order to locate the version tag
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install pypa/build and poetry
run: >-
python -m pip install build poetry --user
- name: Check version tag
run: >-
git describe --always --dirty=-modded --abbrev=7
- name: Build a binary wheel and a source tarball
env:
WORKDIR: ${{ matrix.WORKDIR }}
run: |
export VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')
cd ${{ env.WORKDIR}}
make upgrade-version NEW_VERSION=$VERSION
poetry build
- name: Publish distribution 📦 to Test PyPI
if: github.repository == 'ElementsProject/lightning' && github.ref == "refs/heads/master"
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
WORKDIR: ${{ matrix.WORKDIR }}
run: |
cd ${{ env.WORKDIR}}
python3 -m pip config set global.timeout 150
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --repository testpypi --no-interaction --skip-existing
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags') && github.repository == 'ElementsProject/lightning'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
WORKDIR: ${{ matrix.WORKDIR }}
run: |
cd ${{ env.WORKDIR}}
export VERSION=$(git describe --abbrev=0)
make upgrade-version NEW_VERSION=$VERSION
python3 -m pip config set global.timeout 150
poetry publish --no-interaction