Skip to content

Commit 6cde96f

Browse files
ci(github): add pyinstaller to workflow release-please.yml
1 parent a6fb7e8 commit 6cde96f

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

.github/CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ ruff format
154154

155155
## Build
156156

157-
Generate distribution packages:
157+
Generate the distribution packages:
158158

159159
```sh
160160
python3 -m build
@@ -172,7 +172,13 @@ Install the package:
172172
pip install --index-url https://test.pypi.org/simple/ --no-deps python_cli_template
173173
```
174174

175-
Generate [docs](https://pdoc.dev/):
175+
Bundle the package with [PyInstaller](https://pyinstaller.org/):
176+
177+
```sh
178+
pyinstaller src/python_cli_template/cli.py --name python_cli_template
179+
```
180+
181+
Generate the docs with [pdoc](https://pdoc.dev/):
176182

177183
```sh
178184
pdoc src/python_cli_template/

.github/workflows/release-please.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
release-type: python
2222

2323
publish:
24-
runs-on: ubuntu-latest
2524
needs: release-please
2625
if: ${{ needs.release-please.outputs.release_created }}
26+
runs-on: ubuntu-latest
2727
permissions:
2828
contents: read
2929
id-token: write
@@ -49,3 +49,40 @@ jobs:
4949

5050
- name: Publish package to PyPI
5151
uses: pypa/gh-action-pypi-publish@v1
52+
53+
upload:
54+
needs: release-please
55+
if: ${{ needs.release-please.outputs.release_created }}
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
permissions:
61+
contents: write
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v4
66+
67+
- name: Use Python
68+
uses: actions/setup-python@v5
69+
with:
70+
cache: pip
71+
python-version: 3
72+
73+
- name: Install dependencies
74+
run: pip install pyinstaller
75+
76+
- name: Build binary
77+
run: pyinstaller src/python_cli_template/cli.py --name python_cli_template
78+
79+
- name: Upload Release Artifact
80+
shell: bash
81+
run: |
82+
cd dist
83+
os=${{ matrix.os }}
84+
filename=${os%-*}.zip
85+
zip -r $filename python_cli_template
86+
gh release upload ${{ needs.release.outputs.tag_name }} $filename
87+
env:
88+
GH_TOKEN: ${{ github.token }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ python_cli_template = "python_cli_template.cli:main"
2525
build = [
2626
"build==1.2.2.post1",
2727
"pdoc==15.0.1",
28+
"pyinstaller==6.12.0",
2829
"twine==6.1.0",
2930
]
3031
test = [

0 commit comments

Comments
 (0)