@@ -34,94 +34,16 @@ jobs:
3434 pip install -U pip
3535 pip install -U .
3636
37- package- deploy :
38- name : Build the Python package, and deploy if needed
37+ deploy :
38+ name : Build and deploy ledgerblue package
3939 runs-on : public-ledgerhq-shared-small
4040 needs : build_install
41- permissions :
42- id-token : write
43- attestations : write
44- contents : write
45-
46- steps :
47- - name : Clone
48- uses : actions/checkout@v3
49- with :
50- fetch-depth : 0
51-
52- - name : Install dependencies
53- run : |
54- # Needed to workaround this bug https://github.com/pypa/setuptools/issues/4759
55- # To be removed when it's fixed
56- pip install -U packaging
57-
58- python -m pip install pip --upgrade
59- pip install build twine
60-
61- - name : Build the Python package
62- run : |
63- python -m build
64- twine check dist/*
65- echo "TAG_VERSION=$(python -c 'from ledgerblue import __version__; print(__version__)')" >> "$GITHUB_ENV"
66-
67- - name : Display current status
68- run : |
69- echo "Current status is:"
70- if [[ ${{ github.ref }} == "refs/tags/"* ]];
71- then
72- echo "- Triggered from tag, will be deployed on pypi.org";
73- else
74- echo "- Not triggered from tag, will be deployed on test.pypi.org";
75- fi
76- echo "- Tag version: ${{ env.TAG_VERSION }}";
77-
78- - name : Publish Python package on pypi.org
79- if : success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
80- run : python -m twine upload dist/*
81- env :
82- TWINE_USERNAME : __token__
83- TWINE_PASSWORD : ${{ secrets.PYPI_PUBLIC_API_TOKEN }}
84- TWINE_NON_INTERACTIVE : 1
85-
86- - name : Login to Ledger Artifactory
87- if : success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
88- timeout-minutes : 10
89- id : jfrog-login
90- uses : LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1
91-
92- - name : Publish Python package on Ledger Artifactory
93- if : success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
94- run : python -m twine upload dist/*
95- env :
96- TWINE_REPOSITORY_URL : https://jfrog.ledgerlabs.net/artifactory/api/pypi/embedded-apps-pypi-prod-green
97- TWINE_USERNAME : ${{ steps.jfrog-login.outputs.oidc-user }}
98- TWINE_PASSWORD : ${{ steps.jfrog-login.outputs.oidc-token }}
99- TWINE_NON_INTERACTIVE : 1
100-
101- - name : Generate library build attestations
102- if : success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
103- timeout-minutes : 10
104- uses : LedgerHQ/actions-security/actions/attest@actions/attest-1
105- with :
106- subject-path : dist/*
107-
108- - name : Sign library artifacts
109- if : success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
110- timeout-minutes : 10
111- uses : LedgerHQ/actions-security/actions/sign-blob@actions/sign-blob-1
112- with :
113- path : dist
114-
115- - name : Publish a release on the repo
116- if : |
117- success() &&
118- github.event_name == 'push' &&
119- startsWith(github.ref, 'refs/tags/')
120- uses : " marvinpinto/action-automatic-releases@latest"
121- with :
122- automatic_release_tag : " v${{ env.TAG_VERSION }}"
123- repo_token : " ${{ secrets.GITHUB_TOKEN }}"
124- prerelease : false
125- files : |
126- LICENSE
127- dist/
41+ uses : LedgerHQ/ledger-app-workflows/.github/workflows/reusable_pypi_deployment.yml@v1
42+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
43+ with :
44+ package_name : ledgerblue
45+ jfrog_deployment : true
46+ release : true
47+ publish : true
48+ secrets :
49+ pypi_token : ${{ secrets.PYPI_PUBLIC_API_TOKEN }}
0 commit comments