1- ---
2- name : Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
3- on :
4- push :
5- tags :
6- ' ^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
7- workflow_dispatch :
8- jobs :
9- deploy :
10- name : Build and publish ${{ matrix.package }} 🐍
11- runs-on : ubuntu-20.04
12- timeout-minutes : 120
13- strategy :
14- fail-fast : true
15- matrix :
16- include :
17- - PACKAGE : pyln-client
18- WORKDIR : contrib/ pyln-client
19- - PACKAGE : pyln-testing
20- WORKDIR : contrib/ pyln-testing
21- - PACKAGE : pyln-proto
22- WORKDIR : contrib/ pyln-proto
23- - PACKAGE : pyln-grpc -proto
24- WORKDIR : contrib/ pyln-grpc-proto
25- steps :
26- - name : Checkout repository
27- uses : actions/checkout@v4
28- with :
29- # Need to fetch entire history in order to locate the version tag
30- fetch-depth : 0
31-
32- - name : Check version tag
33- run : >-
34- git describe --always --dirty=-modded --abbrev=7
35-
36- - name : Setup Version
37- env :
38- WORKDIR : ${{ matrix.WORKDIR }}
39- run : |
40- echo "VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV
41-
42- - name : Install Poetry
43- env :
44- WORKDIR : ${{ matrix.WORKDIR }}
45- run : |
46- curl -sSL https://install.python-poetry.org | python3 -
47- echo "$HOME/.local/bin" >> $GITHUB_PATH
48- echo "PATH= $HOME/.local/bin:$PATH"
49-
50- - name : Publish distribution 📦 to Test PyPI
51- if : github.event_name == 'workflow_dispatch' && github.repository == 'ElementsProject/lightning'
52- env :
53- POETRY_PYPI_TOKEN_TESTPYPI : ${{ secrets.TEST_PYPI_API_TOKEN }}
54- WORKDIR : ${{ matrix.WORKDIR }}
55- run : |
56- echo "POETRY VERSION TEST: $(poetry --version)"
57- echo "Pyln* VERSION: $VERSION "
58- cd ${{ env.WORKDIR }}
59- python3 -m pip config set global.timeout 150
60- poetry config repositories.testpypi https://test.pypi.org/legacy/
61- make upgrade-version NEW_VERSION=$VERSION
62- poetry build --no-interaction
63- poetry publish --repository testpypi --no-interaction --skip-existing
64-
65- - name : Publish distribution 📦 to PyPI
66- if : startsWith(github.ref, 'refs/tags/v') && github.repository == 'ElementsProject/lightning'
67- env :
68- POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_API_TOKEN }}
69- WORKDIR : ${{ matrix.WORKDIR }}
70- run : |
71- echo "POETRY VERSION PUBLISH: $(poetry --version)"
72- echo "Pyln* VERSION: $VERSION "
73- cd ${{ env.WORKDIR }}
74- export VERSION=$(git describe --abbrev=0)
75- make upgrade-version NEW_VERSION=$VERSION
76- python3 -m pip config set global.timeout 150
77- poetry build --no-interaction
78- poetry publish --no-interaction
79-
1+ name : Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
3+ on :
4+ push :
5+ tags :
6+ ' ^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
7+ workflow_dispatch :
8+
9+ jobs :
10+ deploy :
11+ name : Build and publish ${{ matrix.package }} 🐍
12+ runs-on : ubuntu-20.04
13+ timeout-minutes : 120
14+ strategy :
15+ fail-fast : true
16+ matrix :
17+ include :
18+ - PACKAGE : pyln-client
19+ WORKDIR : contrib/ pyln-client
20+ - PACKAGE : pyln-testing
21+ WORKDIR : contrib/ pyln-testing
22+ - PACKAGE : pyln-proto
23+ WORKDIR : contrib/ pyln-proto
24+ - PACKAGE : pyln-grpc-proto
25+ WORKDIR : contrib/pyln-grpc-proto
26+ steps :
27+ - name : Checkout repository
28+ uses : actions/checkout@v4
29+ with :
30+ # Need to fetch entire history in order to locate the version tag
31+ fetch-depth : 0
32+
33+ - name : Check version tag
34+ run : >-
35+ git describe --always --dirty=-modded --abbrev=7
36+
37+ - name : Setup Version
38+ env :
39+ WORKDIR : ${{ matrix.WORKDIR }}
40+ run : |
41+ echo "VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV
42+
43+ - name : Install Poetry
44+ env :
45+ WORKDIR : ${{ matrix.WORKDIR }}
46+ run : |
47+ curl -sSL https://install.python-poetry.org | python3 -
48+ echo "$HOME/.local/bin" >> $GITHUB_PATH
49+ echo "PATH=$HOME/.local/bin:$PATH"
50+
51+ - name : Publish distribution 📦 to Test PyPI
52+ if : github.event_name == 'workflow_dispatch' && github.repository == 'ElementsProject/lightning'
53+ env :
54+ POETRY_PYPI_TOKEN_TESTPYPI : ${{ secrets.TEST_PYPI_API_TOKEN }}
55+ WORKDIR : ${{ matrix.WORKDIR }}
56+ run : |
57+ echo "POETRY VERSION TEST : $(poetry --version) "
58+ echo "Pyln* VERSION: $VERSION"
59+ cd ${{ env.WORKDIR }}
60+ python3 -m pip config set global.timeout 150
61+ poetry config repositories.testpypi https://test.pypi.org/legacy/
62+ make upgrade-version NEW_VERSION=$VERSION
63+ poetry build --no-interaction
64+ poetry publish --repository testpypi --no-interaction --skip-existing
65+
66+ - name : Publish distribution 📦 to PyPI
67+ if : startsWith(github.ref, 'refs/tags/v') && github.repository == 'ElementsProject/lightning'
68+ env :
69+ POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_API_TOKEN }}
70+ WORKDIR : ${{ matrix.WORKDIR }}
71+ run : |
72+ echo "POETRY VERSION PUBLISH : $(poetry --version) "
73+ echo "Pyln* VERSION: $VERSION"
74+ cd ${{ env.WORKDIR }}
75+ export VERSION=$(git describe --abbrev=0)
76+ make upgrade-version NEW_VERSION=$VERSION
77+ python3 -m pip config set global.timeout 150
78+ poetry build --no-interaction
79+ poetry publish --no-interaction
0 commit comments