mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-22 15:24:21 +01:00
I was wondering why the workflow never published, turns out we were triggering on branch pushes only, not tags. So the branch would get pushed, but the tag is pushed afterwards, and thus not triggering.
80 lines
2.5 KiB
YAML
80 lines
2.5 KiB
YAML
---
|
|
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
|
on:
|
|
# Only deploy if we're the result of a PR being merged
|
|
push:
|
|
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
|
|
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: 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.7
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.7
|
|
|
|
- name: Install pypa/build and poetry
|
|
run: >-
|
|
python -m pip install build poetry --user
|
|
|
|
- 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}}
|
|
poetry version $VERSION
|
|
poetry build
|
|
|
|
- name: Publish distribution 📦 to Test PyPI
|
|
if: github.repository == 'ElementsProject/lightning'
|
|
env:
|
|
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
WORKDIR: ${{ matrix.WORKDIR }}
|
|
run: |
|
|
cd ${{ env.WORKDIR}}
|
|
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
|
poetry publish --repository testpypi --no-interaction
|
|
|
|
- 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)
|
|
poetry version $VERSION
|
|
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
|
poetry publish --repository testpypi --no-interaction
|