Skip to content

Commit 233f863

Browse files
committed
Update publish workflow
1 parent 9a5d089 commit 233f863

File tree

2 files changed

+82
-49
lines changed

2 files changed

+82
-49
lines changed

.github/workflows/python-publish.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v4
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
14-
with:
15-
python-version: "3.x"
16-
- name: Install pypa/build
17-
run: >-
18-
python3 -m
19-
pip install
20-
build
21-
--user
22-
- name: Build a binary wheel and a source tarball
23-
run: python3 -m build
24-
- name: Store the distribution packages
25-
uses: actions/upload-artifact@v3
26-
with:
27-
name: python-package-distributions
28-
path: dist/
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.x"
16+
- name: Install pypa/build
17+
run: >-
18+
python3 -m
19+
pip install
20+
build
21+
--user
22+
- name: Build a binary wheel and a source tarball
23+
run: python3 -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: python-package-distributions
28+
path: dist/
2929

3030
publish-to-pypi:
3131
name: >-
3232
Publish Python 🐍 distribution 📦 to PyPI
33-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3434
needs:
35-
- build
35+
- build
3636
runs-on: ubuntu-latest
3737
environment:
3838
name: pypi
@@ -41,42 +41,42 @@ jobs:
4141
id-token: write
4242

4343
steps:
44-
- name: Download all the dists
45-
uses: actions/download-artifact@v3
46-
with:
47-
name: python-package-distributions
48-
path: dist/
49-
- name: Publish distribution 📦 to PyPI
50-
uses: pypa/gh-action-pypi-publish@release/v1
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Publish distribution 📦 to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
5151

5252
github-release:
5353
name: >-
5454
Upload distribution to GitHub Release
5555
needs:
56-
- publish-to-pypi
56+
- publish-to-pypi
5757
runs-on: ubuntu-latest
5858

5959
permissions:
60-
contents: write # IMPORTANT: mandatory for making GitHub Releases
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
6161

6262
steps:
63-
- name: Download all the dists
64-
uses: actions/download-artifact@v3
65-
with:
66-
name: python-package-distributions
67-
path: dist/
68-
- name: Create GitHub Release
69-
env:
70-
GITHUB_TOKEN: ${{ github.token }}
71-
run: >-
72-
gh release create
73-
'${{ github.ref_name }}'
74-
--repo '${{ github.repository }}'
75-
--notes ""
76-
- name: Upload artifacts to GitHub Release
77-
env:
78-
GITHUB_TOKEN: ${{ github.token }}
79-
run: >-
80-
gh release upload
81-
'${{ github.ref_name }}' dist/**
82-
--repo '${{ github.repository }}'
63+
- name: Download all the dists
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
- name: Create GitHub Release
69+
env:
70+
GITHUB_TOKEN: ${{ github.token }}
71+
run: >-
72+
gh release create
73+
'${{ github.ref_name }}'
74+
--repo '${{ github.repository }}'
75+
--notes ""
76+
- name: Upload artifacts to GitHub Release
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
run: >-
80+
gh release upload
81+
'${{ github.ref_name }}' dist/**
82+
--repo '${{ github.repository }}'

keytool.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from cryptography.hazmat.backends import default_backend
2+
from cryptography.hazmat.primitives import serialization
3+
from cryptography.hazmat.primitives.asymmetric import ec
4+
5+
6+
with open("tesla_private_key.pem", "rb") as key_file:
7+
key_data = key_file.read()
8+
9+
private_key = serialization.load_pem_private_key(
10+
key_data, password=None, backend=default_backend()
11+
)
12+
13+
if not isinstance(private_key, ec.EllipticCurvePrivateKey):
14+
raise AssertionError("Loaded key is not an EllipticCurvePrivateKey")
15+
16+
private_bytes = private_key.private_bytes(
17+
encoding=serialization.Encoding.DER,
18+
format=serialization.PrivateFormat.PKCS8,
19+
encryption_algorithm=serialization.NoEncryption()
20+
)
21+
print("PRIVATE",private_bytes.hex())
22+
23+
#with open("private.key", "wb") as f:
24+
# f.write(private_bytes)
25+
26+
public_bytes = private_key.public_key().public_bytes(
27+
encoding=serialization.Encoding.X962, format=serialization.PublicFormat.UncompressedPoint
28+
)
29+
30+
print("PUBLIC",public_bytes.hex())
31+
32+
#with open("public.key", "wb") as f:
33+
# f.write(public_bytes)

0 commit comments

Comments
 (0)