2021-08-23 13:36:20 +02:00
|
|
|
---
|
|
|
|
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
2021-09-23 15:48:02 +02:00
|
|
|
on:
|
|
|
|
# Only deploy if we're the result of a PR being merged
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2022-08-25 17:10:40 +02:00
|
|
|
tags:
|
|
|
|
# Semantic versioning tags
|
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
# Date style tags
|
|
|
|
- 'v[0-9]{2}.[0-9]{2}'
|
2021-08-23 13:36:20 +02:00
|
|
|
jobs:
|
|
|
|
deploy:
|
2021-09-23 14:06:47 +02:00
|
|
|
name: Build and publish ${{ matrix.package }} 🐍
|
2021-08-23 13:36:20 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2023-02-08 17:11:45 +01:00
|
|
|
timeout-minutes: 120
|
2021-08-23 13:36:20 +02:00
|
|
|
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
|
2023-06-20 16:12:37 +02:00
|
|
|
- PACKAGE: pyln-grpc-proto
|
|
|
|
WORKDIR: contrib/pyln-grpc-proto
|
2022-08-25 17:22:00 +02:00
|
|
|
# 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/
|
2021-09-23 14:06:47 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@master
|
|
|
|
with:
|
|
|
|
# Need to fetch entire history in order to locate the version tag
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-07-20 01:01:11 +02:00
|
|
|
- name: Set up Python 3.8
|
2021-09-23 14:06:47 +02:00
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
2023-07-20 01:01:11 +02:00
|
|
|
python-version: 3.8
|
2021-09-23 14:06:47 +02:00
|
|
|
|
2022-03-29 13:35:06 +02:00
|
|
|
- name: Install pypa/build and poetry
|
2021-09-23 14:06:47 +02:00
|
|
|
run: >-
|
2022-03-29 13:35:06 +02:00
|
|
|
python -m pip install build poetry --user
|
2021-09-23 14:06:47 +02:00
|
|
|
|
2022-08-25 17:22:00 +02:00
|
|
|
- name: Check version tag
|
|
|
|
run: >-
|
|
|
|
git describe --always --dirty=-modded --abbrev=7
|
|
|
|
|
2021-08-23 13:36:20 +02:00
|
|
|
- name: Build a binary wheel and a source tarball
|
|
|
|
env:
|
|
|
|
WORKDIR: ${{ matrix.WORKDIR }}
|
2022-03-29 13:35:06 +02:00
|
|
|
run: |
|
|
|
|
export VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')
|
|
|
|
cd ${{ env.WORKDIR}}
|
2022-08-25 17:22:00 +02:00
|
|
|
make upgrade-version NEW_VERSION=$VERSION
|
2022-03-29 13:35:06 +02:00
|
|
|
poetry build
|
2021-09-23 14:06:47 +02:00
|
|
|
|
|
|
|
- name: Publish distribution 📦 to Test PyPI
|
2021-10-06 15:56:34 +02:00
|
|
|
if: github.repository == 'ElementsProject/lightning'
|
2021-08-23 13:36:20 +02:00
|
|
|
env:
|
2022-03-29 13:35:06 +02:00
|
|
|
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
2021-08-23 13:36:20 +02:00
|
|
|
WORKDIR: ${{ matrix.WORKDIR }}
|
2022-03-29 13:35:06 +02:00
|
|
|
run: |
|
|
|
|
cd ${{ env.WORKDIR}}
|
2023-12-01 11:05:58 +01:00
|
|
|
python3 -m pip config set global.timeout 150
|
2022-03-29 13:35:06 +02:00
|
|
|
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
|
|
|
poetry publish --repository testpypi --no-interaction
|
2021-09-23 14:06:47 +02:00
|
|
|
|
2021-09-23 14:00:55 +02:00
|
|
|
- name: Publish distribution 📦 to PyPI
|
2021-10-06 15:56:34 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags') && github.repository == 'ElementsProject/lightning'
|
2021-09-23 14:00:55 +02:00
|
|
|
env:
|
2022-03-29 13:35:06 +02:00
|
|
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
2021-09-23 14:00:55 +02:00
|
|
|
WORKDIR: ${{ matrix.WORKDIR }}
|
2022-03-29 13:35:06 +02:00
|
|
|
run: |
|
|
|
|
cd ${{ env.WORKDIR}}
|
|
|
|
export VERSION=$(git describe --abbrev=0)
|
2022-08-25 17:22:00 +02:00
|
|
|
make upgrade-version NEW_VERSION=$VERSION
|
2023-12-01 11:05:58 +01:00
|
|
|
python3 -m pip config set global.timeout 150
|
2023-08-12 02:18:52 +02:00
|
|
|
poetry publish --no-interaction
|