Skip to content

Commit 57a34f4

Browse files
authored
Add CI/CD workflow for libcrypto to PyPI
This workflow automates testing and deployment of the libcrypto package to PyPI, including version bumping and GitHub release creation.
1 parent 6fe13ae commit 57a34f4

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: LibCrypto Test & Deploy - Publish to PYPI
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", "3.14"]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install setuptools wheel twine
33+
pip install -r requirements.txt
34+
pip install .[test]
35+
36+
- name: Run pytest
37+
run: pytest -q
38+
39+
- name: Lint with flake8
40+
run: |
41+
pip install flake8
42+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
44+
45+
publish:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
49+
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v2
54+
55+
- name: Set up Python 3.x
56+
uses: actions/setup-python@v2
57+
with:
58+
python-version: 3.x
59+
60+
- name: Install dependencies
61+
run: |
62+
python -m pip install --upgrade pip
63+
pip install setuptools wheel twine
64+
65+
- name: Get Bumper File
66+
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
67+
68+
- name: Run Bump script
69+
run: python bump_version.py libcrypto
70+
71+
- name: Remove Bump Script
72+
run: rm -r bump_version.py
73+
74+
- name: Bump version
75+
run: |
76+
git config --global user.name 'github-actions'
77+
git config --global user.email 'github-actions@github.com'
78+
git add setup.py pyproject.toml src/libcrypto/__init__.py
79+
git add .
80+
git commit -m 'version Update Mode'
81+
git push origin main
82+
83+
- name: Build libcrypto Package
84+
run: |
85+
python setup.py sdist bdist_wheel
86+
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Publish package to PyPI
91+
env:
92+
TWINE_USERNAME: __token__
93+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
94+
run: |
95+
twine upload dist/*
96+
97+
- name: Create GitHub Release
98+
id: create_release
99+
uses: softprops/action-gh-release@v2
100+
with:
101+
tag_name: "v${{ env.NEW_VERSION }}"
102+
name: "libcrypto v${{ env.NEW_VERSION }}"
103+
body: |
104+
## libcrypto New Release `${{ env.NEW_VERSION }}`
105+
106+
> [!NOTE]
107+
> New version of libcrypto has been released `v${{ env.NEW_VERSION }}`, Check the latest features and updates in this release.
108+
109+
install and use libcrypto with `pip` and `pip3` follow command :
110+
111+
### Windows
112+
113+
```bash
114+
pip install libcrypto
115+
# or
116+
pip install libcrypto==${{ env.NEW_VERSION }}
117+
```
118+
##### upgrade : `pip install libcrypto --upgrade`
119+
120+
---
121+
122+
### Linux & MacOS
123+
124+
```bash
125+
pip3 install libcrypto
126+
# or
127+
pip3 install libcrypto==${{ env.NEW_VERSION }}
128+
```
129+
130+
##### upgrade : `pip3 install libcrypto --upgrade`
131+
132+
---
133+
134+
- [Documentation](https://libcrypto.readthedocs.io/)
135+
- [PyPi Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/)
136+
- [PyPi History](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#history)
137+
- [Description Package](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#description)
138+
- [Download Files](https://pypi.org/project/libcrypto/${{ env.NEW_VERSION }}/#files)
139+
140+
Programmer and Owner : @Pymmdrza
141+
142+
files: |
143+
dist/libcrypto-${{ env.NEW_VERSION }}.tar.gz
144+
dist/libcrypto-${{ env.NEW_VERSION }}-py3-none-any.whl

0 commit comments

Comments
 (0)