mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
github: Update Github actions for Pypi publishing
Changelog-Fixed: Fixed the already existing Pypi publishing actions file.
This commit is contained in:
parent
dadf9a78e2
commit
3a4dd5f032
1 changed files with 78 additions and 90 deletions
168
.github/workflows/pypi.yml
vendored
168
.github/workflows/pypi.yml
vendored
|
@ -1,91 +1,79 @@
|
||||||
---
|
---
|
||||||
name: Publish Python π distributions π¦ to PyPI and TestPyPI
|
name: Publish Python π distributions π¦ to PyPI and TestPyPI
|
||||||
on:
|
on:
|
||||||
# Only deploy if we're the result of a PR being merged
|
push:
|
||||||
workflow_dispatch:
|
tags:
|
||||||
push:
|
'^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
|
||||||
branches:
|
workflow_dispatch:
|
||||||
- master
|
jobs:
|
||||||
tags:
|
deploy:
|
||||||
# Semantic versioning tags
|
name: Build and publish ${{ matrix.package }} π
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
runs-on: ubuntu-20.04
|
||||||
# Date style tags
|
timeout-minutes: 120
|
||||||
- 'v[0-9]{2}.[0-9]{2}'
|
strategy:
|
||||||
jobs:
|
fail-fast: true
|
||||||
deploy:
|
matrix:
|
||||||
name: Build and publish ${{ matrix.package }} π
|
include:
|
||||||
runs-on: ubuntu-20.04
|
- PACKAGE: pyln-client
|
||||||
timeout-minutes: 120
|
WORKDIR: contrib/pyln-client
|
||||||
strategy:
|
- PACKAGE: pyln-testing
|
||||||
fail-fast: true
|
WORKDIR: contrib/pyln-testing
|
||||||
matrix:
|
- PACKAGE: pyln-proto
|
||||||
include:
|
WORKDIR: contrib/pyln-proto
|
||||||
- PACKAGE: pyln-client
|
- PACKAGE: pyln-grpc-proto
|
||||||
WORKDIR: contrib/pyln-client
|
WORKDIR: contrib/pyln-grpc-proto
|
||||||
- PACKAGE: pyln-testing
|
steps:
|
||||||
WORKDIR: contrib/pyln-testing
|
- name: Checkout repository
|
||||||
- PACKAGE: pyln-proto
|
uses: actions/checkout@v4
|
||||||
WORKDIR: contrib/pyln-proto
|
with:
|
||||||
- PACKAGE: pyln-grpc-proto
|
# Need to fetch entire history in order to locate the version tag
|
||||||
WORKDIR: contrib/pyln-grpc-proto
|
fetch-depth: 0
|
||||||
# Bolt packages are handled differently
|
|
||||||
#- PACKAGE: pyn-bolt1
|
- name: Check version tag
|
||||||
# WORKDIR: contrib/pyln-spec/bolt1/
|
run: >-
|
||||||
#- PACKAGE: pyn-bolt2
|
git describe --always --dirty=-modded --abbrev=7
|
||||||
# WORKDIR: contrib/pyln-spec/bolt2/
|
|
||||||
#- PACKAGE: pyn-bolt4
|
- name: Setup Version
|
||||||
# WORKDIR: contrib/pyln-spec/bolt4/
|
env:
|
||||||
#- PACKAGE: pyn-bolt7
|
WORKDIR: ${{ matrix.WORKDIR }}
|
||||||
# WORKDIR: contrib/pyln-spec/bolt7/
|
run: |
|
||||||
steps:
|
echo "VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
- name: Install Poetry
|
||||||
# Need to fetch entire history in order to locate the version tag
|
env:
|
||||||
fetch-depth: 0
|
WORKDIR: ${{ matrix.WORKDIR }}
|
||||||
|
run: |
|
||||||
- name: Set up Python 3.8
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
uses: actions/setup-python@v5
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
with:
|
echo "PATH=$HOME/.local/bin:$PATH"
|
||||||
python-version: 3.8
|
|
||||||
|
- name: Publish distribution π¦ to Test PyPI
|
||||||
- name: Install pypa/build and poetry
|
if: github.event_name == 'workflow_dispatch' && github.repository == 'ElementsProject/lightning'
|
||||||
run: >-
|
env:
|
||||||
python -m pip install build poetry --user
|
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||||
|
WORKDIR: ${{ matrix.WORKDIR }}
|
||||||
- name: Check version tag
|
run: |
|
||||||
run: >-
|
echo "POETRY VERSION TEST: $(poetry --version)"
|
||||||
git describe --always --dirty=-modded --abbrev=7
|
echo "Pyln* VERSION: $VERSION"
|
||||||
|
cd ${{ env.WORKDIR }}
|
||||||
- name: Build a binary wheel and a source tarball
|
python3 -m pip config set global.timeout 150
|
||||||
env:
|
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
||||||
WORKDIR: ${{ matrix.WORKDIR }}
|
make upgrade-version NEW_VERSION=$VERSION
|
||||||
run: |
|
poetry build --no-interaction
|
||||||
export VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')
|
poetry publish --repository testpypi --no-interaction --skip-existing
|
||||||
cd ${{ env.WORKDIR }}
|
|
||||||
make upgrade-version NEW_VERSION=$VERSION
|
- name: Publish distribution π¦ to PyPI
|
||||||
poetry build --no-interaction
|
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'ElementsProject/lightning'
|
||||||
|
env:
|
||||||
- name: Publish distribution π¦ to Test PyPI
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
if: github.repository == 'ElementsProject/lightning' && github.ref == 'refs/heads/master'
|
WORKDIR: ${{ matrix.WORKDIR }}
|
||||||
env:
|
run: |
|
||||||
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
echo "POETRY VERSION PUBLISH: $(poetry --version)"
|
||||||
WORKDIR: ${{ matrix.WORKDIR }}
|
echo "Pyln* VERSION: $VERSION"
|
||||||
run: |
|
cd ${{ env.WORKDIR }}
|
||||||
cd ${{ env.WORKDIR }}
|
export VERSION=$(git describe --abbrev=0)
|
||||||
python3 -m pip config set global.timeout 150
|
make upgrade-version NEW_VERSION=$VERSION
|
||||||
poetry config repositories.testpypi https://test.pypi.org/legacy/
|
python3 -m pip config set global.timeout 150
|
||||||
poetry build --no-interaction
|
poetry build --no-interaction
|
||||||
poetry publish --repository testpypi --no-interaction --skip-existing
|
poetry publish --no-interaction
|
||||||
|
|
||||||
- name: Publish distribution π¦ to PyPI
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v') && 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 build --no-interaction
|
|
||||||
poetry publish --no-interaction
|
|
Loadingβ¦
Add table
Reference in a new issue