Skip to content

Commit 602ad45

Browse files
committed
Add deploy workflow and update PyPI publish workflow
Introduces a new GitHub Actions workflow for building and releasing the libcrypto package to PyPI, including version bumping and release creation. Cleans up the existing publish-to-pypi workflow by removing steps for verifying external crypto dependencies and uploading distribution artifacts.
1 parent 21ac9f9 commit 602ad45

File tree

2 files changed

+171
-10
lines changed

2 files changed

+171
-10
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: libcrypto Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python 3.12
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
cache: "pip"
29+
30+
- name: bumper version
31+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
32+
33+
- name: Run Bump script and set version to env
34+
run: python bump_version.py libcrypto
35+
36+
- name: Remove Bump Script
37+
run: rm -r bump_version.py
38+
39+
- name: Bump version
40+
run: |
41+
git config --global user.name 'github-actions'
42+
git config --global user.email '[email protected]'
43+
git add setup.py pyproject.toml src/libcrypto/__init__.py
44+
git add .
45+
git commit -m 'version Update Mode'
46+
git push origin main
47+
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install pytest pytest-cov
52+
pip install -r requirements.txt
53+
54+
- name: Install package in development mode
55+
run: |
56+
pip install -e .
57+
58+
- name: Run tests
59+
run: |
60+
pytest tests/ -v --cov=libcrypto --cov-report=term-missing
61+
62+
- name: Install build tools
63+
run: |
64+
pip install build twine
65+
66+
- name: Build package
67+
run: |
68+
python -m build
69+
70+
- name: Check distribution
71+
run: |
72+
twine check dist/*
73+
publish:
74+
needs: build
75+
runs-on: ubuntu-latest
76+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
77+
78+
steps:
79+
- name: Checkout repository
80+
uses: actions/checkout@v2
81+
82+
- name: Set up Python 3.12
83+
uses: actions/setup-python@v2
84+
with:
85+
python-version: "3.12"
86+
87+
- name: Install dependencies
88+
run: |
89+
python -m pip install --upgrade pip
90+
pip install setuptools wheel twine
91+
92+
- name: Get Bumper File
93+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
94+
95+
- name: Run Bump script
96+
run: python bump_version.py libcrypto
97+
98+
- name: Remove Bump Script
99+
run: rm -r bump_version.py
100+
101+
- name: Bump version
102+
run: |
103+
git config --global user.name 'github-actions'
104+
git config --global user.email '[email protected]'
105+
git add setup.py pyproject.toml src/libcrypto/__init__.py
106+
git add .
107+
git commit -m 'version Update Mode'
108+
git push origin main
109+
110+
- name: Build libcrypto Package
111+
run: |
112+
python setup.py sdist bdist_wheel
113+
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
117+
- name: Publish package to PyPI
118+
env:
119+
TWINE_USERNAME: __token__
120+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
121+
run: |
122+
twine upload dist/*
123+
124+
- name: Create GitHub Release
125+
id: create_release
126+
uses: softprops/action-gh-release@v2
127+
with:
128+
tag_name: "v${{ env.NEW_VERSION }}"
129+
name: "libcrypto v${{ env.NEW_VERSION }}"
130+
body: |
131+
## libcrypto New Release `${{ env.NEW_VERSION }}`
132+
133+
> [!NOTE]
134+
> New version of libcrypto has been released `v${{ env.NEW_VERSION }}`, Check the latest features and updates in this release.
135+
136+
install and use libcrypto with `pip` and `pip3` follow command :
137+
138+
### Windows
139+
140+
```bash
141+
pip install libcrypto
142+
# or
143+
pip install libcrypto==${{ env.NEW_VERSION }}
144+
```
145+
##### upgrade : `pip install libcrypto --upgrade`
146+
147+
---
148+
149+
### Linux & MacOS
150+
151+
```bash
152+
pip3 install libcrypto
153+
# or
154+
pip3 install libcrypto==${{ env.NEW_VERSION }}
155+
```
156+
157+
##### upgrade : `pip3 install libcrypto --upgrade`
158+
159+
---
160+
161+
- [Documentation](https://libcrypto.readthedocs.io/)
162+
- [PyPi Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/)
163+
- [PyPi History](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#history)
164+
- [Description Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#description)
165+
- [Download Files](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#files)
166+
167+
Programmer and Owner : @Pymmdrza
168+
169+
files: |
170+
dist/libcrypto-${{ env.NEW_VERSION }}.tar.gz
171+
dist/libcrypto-${{ env.NEW_VERSION }}-py3-none-any.whl

.github/workflows/publish-to-pypi.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ jobs:
5656
run: |
5757
pytest tests/ -v --cov=libcrypto --cov-report=term-missing
5858
59-
- name: Verify no external crypto dependencies
60-
run: |
61-
python verify_no_deps.py
62-
6359
- name: Install build tools
6460
run: |
6561
pip install build twine
@@ -72,12 +68,6 @@ jobs:
7268
run: |
7369
twine check dist/*
7470
75-
- name: Upload distribution artifacts
76-
uses: actions/upload-artifact@v4
77-
with:
78-
name: python-package-distributions
79-
path: dist/
80-
retention-days: 7
8171
8272
publish-to-pypi:
8373
name: Publish to PyPI

0 commit comments

Comments
 (0)