-
Notifications
You must be signed in to change notification settings - Fork 9
208 lines (165 loc) · 7.37 KB
/
deploy-pypi-release.yaml
File metadata and controls
208 lines (165 loc) · 7.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: libcrypto Package
on:
push:
tags:
- "v*.*.*"
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -r requirements.txt
- name: Install package in development mode
run: |
pip install -e .
- name: Run tests
run: |
pytest tests/ -v --cov=libcrypto --cov-report=term-missing
build-and-publish:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
environment:
name: pypi
url: https://pypi.org/p/libcrypto
permissions:
id-token: write # برای Trusted Publishers
contents: write # برای push و release
outputs:
new_version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
ref: main
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Get Bumper File
run: curl -o bump_version.py ${{ secrets.BUMP_URL }}
- name: Run Bump script and capture version
id: get_version
run: |
NEW_VERSION=$(python bump_version.py libcrypto)
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "New version: $NEW_VERSION"
- name: Remove Bump Script
run: rm -f bump_version.py
- name: Commit and push version bump
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add setup.py pyproject.toml src/libcrypto/__init__.py
if ! git diff --staged --quiet; then
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}"
git push origin main
echo "Version bumped and pushed successfully"
else
echo "No version changes detected"
fi
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Build libcrypto Package
run: |
python -m build
- name: List distribution files
run: |
echo "Distribution files:"
ls -lh dist/
- name: Publish to PyPI using Trusted Publisher
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
- name: Create GitHub Release
if: success()
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ steps.get_version.outputs.version }}"
name: "libcrypto v${{ steps.get_version.outputs.version }}"
body: |
## libcrypto New Release `${{ steps.get_version.outputs.version }}`
> [!NOTE]
> New version of libcrypto has been released `v${{ steps.get_version.outputs.version }}`, Check the latest features and updates in this release.
install and use libcrypto with `pip` and `pip3` follow command :
### Windows
```bash
pip install libcrypto
# or
pip install libcrypto==${{ steps.get_version.outputs.version }}
```
##### upgrade : `pip install libcrypto --upgrade`
---
### Linux & MacOS
```bash
pip3 install libcrypto
# or
pip3 install libcrypto==${{ steps.get_version.outputs.version }}
```
##### upgrade : `pip3 install libcrypto --upgrade`
---
- [Documentation](https://libcrypto.readthedocs.io/)
- [PyPi Package](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/)
- [PyPi History](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#history)
- [Description Package](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#description)
- [Download Files](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#files)
Programmer and Owner : @Pymmdrza
files: |
dist/libcrypto-${{ steps.get_version.outputs.version }}.tar.gz
dist/libcrypto-${{ steps.get_version.outputs.version }}-py3-none-any.whl
draft: false
prerelease: false
test-pypi-installation:
needs: build-and-publish
name: Test PyPI Installation on ${{ matrix.os }} - Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Wait for PyPI to update
run: sleep 90
- name: Install from PyPI
run: |
pip install libcrypto --upgrade --no-cache-dir
- name: Test import
run: |
python -c "import libcrypto; print('LibCrypto version:', libcrypto.__version__)"
- name: Test basic functionality
run: |
python -c "from libcrypto import PrivateKey, Wallet, generate_mnemonic; pk = PrivateKey(1); print('All tests passed successfully')"
- name: CLI Test
run: |
libcrypto -v
libcrypto generate