Skip to content

Commit 13f9533

Browse files
ci: adding jfrog publication
1 parent e737021 commit 13f9533

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: build
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ledgerhq-shared-small
11+
permissions:
12+
id-token: write
13+
contents: read
14+
attestations: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.10'
20+
- run: |
21+
pip install tox
22+
tox -e build
23+
# initiate jfrog login and install jf
24+
- name: Login to JFrog Ledger
25+
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1
26+
# upload package to jfrog
27+
- name: upload package
28+
run: jf rt u --build-name=python-etcd3-release --build-number=1 --module=etcd3 'dist/*.tar.gz' enclave-pypi-prod-green
29+
# attest that the delivered package is authenticated as a CI build
30+
- name: Attest
31+
id: attest
32+
uses: LedgerHQ/actions-security/actions/attest@actions/attest-1
33+
with:
34+
subject-path: 'dist/*.tar.gz'
35+
push-to-registry: false
36+
- uses: LedgerHQ/actions/gemfury/publish@main
37+
env:
38+
PUSH_TOKEN: ${{ secrets.PYPI_PUSH_TOKEN }}
39+
- uses: LedgerHQ/actions/nexus/publish@main
40+
env:
41+
GREEN_NEXUS_HOST: ${{ vars.GREEN_NEXUS_HOST }}
42+
GREEN_NEXUS_USER: ${{ vars.GREEN_NEXUS_USER }}
43+
GREEN_NEXUS_PASSWORD: ${{ secrets.GREEN_NEXUS_PASSWORD }}
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: dist-${{ github.run_id }}
47+
path: |
48+
dist
49+
retention-days: 2
50+
51+
validate:
52+
runs-on: ledgerhq-shared-small
53+
permissions:
54+
id-token: write
55+
contents: read
56+
needs:
57+
- publish
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions/download-artifact@v4
61+
with:
62+
name: dist-${{ github.run_id }}
63+
path: dist
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: '3.10'
67+
cache: 'pip'
68+
- run: |
69+
pip install build twine wheel-filename blob
70+
# in order to allow test pip install after publish, get back pkg version
71+
- name: get back local build version
72+
id: get_pkg_version
73+
run: |
74+
from wheel_filename import parse_wheel_filename
75+
import glob
76+
import os
77+
from random import choices
78+
from string import ascii_letters
79+
80+
whl = str(glob.glob('dist/*.whl')[0]);
81+
pwf = parse_wheel_filename('dist/' + whl);
82+
with open(os.environ["GITHUB_OUTPUT"], "a") as gh_output:
83+
delimiter = "".join(choices(ascii_letters, k=16))
84+
gh_output.writelines([
85+
f"pkg_version<<{delimiter}\n",
86+
f"{pwf.version}\n",
87+
delimiter + "\n",
88+
])
89+
shell: python
90+
- name: Login to JFrog Ledger
91+
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1
92+
# configure jfrog repo and test pip install from it for the delivered package
93+
- name: set jfrog Repo URL
94+
run: jf pipc --global --repo-resolve=enclave-pypi-virtual-green
95+
- name: test install from jfrog
96+
run: |
97+
jf pip install etcd3==${{ steps.get_pkg_version.outputs.pkg_version }}
98+
pip show etcd3
99+
shell: bash

0 commit comments

Comments
 (0)