[ci][client] Eth Python client automatically infer its version from tags
This commit is contained in:
48
.github/workflows/python-client.yml
vendored
48
.github/workflows/python-client.yml
vendored
@@ -4,6 +4,8 @@ name: Python client checks, package build and deployment
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
tags:
|
||||||
|
- 'client-*'
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
- master
|
- master
|
||||||
@@ -36,50 +38,6 @@ jobs:
|
|||||||
- name: Mypy type checking
|
- name: Mypy type checking
|
||||||
run: (cd client && mypy src/)
|
run: (cd client && mypy src/)
|
||||||
|
|
||||||
get-develop-version:
|
|
||||||
name: Get develop version
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'develop' }}
|
|
||||||
outputs:
|
|
||||||
develop_version: ${{ steps.get-version.outputs.develop_version }}
|
|
||||||
steps:
|
|
||||||
- name: Check Out Code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: develop
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.12.0
|
|
||||||
- name: Get version
|
|
||||||
id: get-version
|
|
||||||
env:
|
|
||||||
PYTHONPATH: client/src/ledger_app_clients
|
|
||||||
run: |
|
|
||||||
echo "develop_version=$(python -c 'from ethereum import __version__; print(__version__)')" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
version-check:
|
|
||||||
name: Check Version when opening a PR against develop
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: get-develop-version
|
|
||||||
steps:
|
|
||||||
- name: Check Out Code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.12.0
|
|
||||||
- name: Check Version Bump
|
|
||||||
env:
|
|
||||||
DEVELOP_VERSION: ${{needs.get-develop-version.outputs.develop_version}}
|
|
||||||
PYTHONPATH: client/src/ledger_app_clients
|
|
||||||
run: |
|
|
||||||
current_version=$(python -c "from ethereum import __version__; print(__version__)")
|
|
||||||
if [[ "$current_version" == "$DEVELOP_VERSION" ]]; then
|
|
||||||
echo "Version in __init__.py hasn't been bumped. Please bump the version before merging."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
packaging:
|
packaging:
|
||||||
needs: [lint, mypy]
|
needs: [lint, mypy]
|
||||||
name: Build, test and deploy the Python package
|
name: Build, test and deploy the Python package
|
||||||
@@ -87,7 +45,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
package_directory: "client/"
|
package_directory: "client/"
|
||||||
stable_deployment: true
|
stable_deployment: true
|
||||||
check_changelog_version: true
|
check_changelog_version: ${{ startsWith(github.ref,'refs/tags/') }}
|
||||||
publish: ${{ github.event_name == 'push' }}
|
publish: ${{ github.event_name == 'push' }}
|
||||||
secrets:
|
secrets:
|
||||||
pypi_token: secrets.PYPI_PUBLIC_API_TOKEN
|
pypi_token: secrets.PYPI_PUBLIC_API_TOKEN
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,7 +9,7 @@ build/
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
*.pyc
|
*.pyc
|
||||||
|
__version__.py
|
||||||
|
|
||||||
# JS
|
# JS
|
||||||
tests/node_modules
|
tests/node_modules
|
||||||
|
|||||||
@@ -34,8 +34,12 @@ dependencies = [
|
|||||||
[tools.setuptools]
|
[tools.setuptools]
|
||||||
include-package-data = true
|
include-package-data = true
|
||||||
|
|
||||||
[tool.setuptools.dynamic]
|
[tool.setuptools_scm]
|
||||||
version = {attr = "ledger_app_clients.ethereum.__version__"}
|
version_file = "src/ledger_app_clients/ethereum/__version__.py"
|
||||||
|
local_scheme = "no-local-version"
|
||||||
|
root = "../"
|
||||||
|
git_describe_command = "git describe --dirty --tags --long --match client-*[0-9]*"
|
||||||
|
fallback_version = "0.0.0"
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Home = "https://github.com/LedgerHQ/app-ethereum"
|
Home = "https://github.com/LedgerHQ/app-ethereum"
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
__version__ = "0.2.0"
|
try:
|
||||||
|
from ledger_app_clients.ethereum.__version__ import __version__ # noqa
|
||||||
|
except ImportError:
|
||||||
|
__version__ = "unknown version" # noqa
|
||||||
|
|||||||
Reference in New Issue
Block a user