Skip to content

Commit de67aab

Browse files
committed
build: add github workflow to build and publish to pypi
This is long overdue, but we should be publishing to pypi to amke the program easier for people to install and use.
1 parent 8d72cbd commit de67aab

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed

.github/workflows/unittests.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Continuous Integration
33

44
on:
55
push:
6-
branches:
7-
- 'master'
86
pull_request:
97

108
jobs:
@@ -14,6 +12,8 @@ jobs:
1412

1513
steps:
1614
- uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
1717
- name: Set up Python 3.9
1818
uses: actions/setup-python@v5
1919
with:
@@ -30,3 +30,59 @@ jobs:
3030
- name: Run unit tests
3131
run: |
3232
uv run pytest
33+
- name: Build distribution artifacts
34+
run: |
35+
uv build
36+
- name: Store artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distribution
40+
path: dist/
41+
42+
publish-to-pypi:
43+
name: Publish to PyPI
44+
needs:
45+
- continous-integration
46+
47+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
48+
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: pypi
52+
url: https://pypi.org/p/evdevremapkeys
53+
permissions:
54+
id-token: write # IMPORTANT: mandatory for trusted publishing
55+
56+
steps:
57+
- name: Download all the dists
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
- name: Publish distribution 📦 to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
65+
publish-to-testpypi:
66+
name: Publish Python 🐍 distribution 📦 to TestPyPI
67+
needs:
68+
- continous-integration
69+
70+
runs-on: ubuntu-latest
71+
72+
environment:
73+
name: testpypi
74+
url: https://test.pypi.org/p/evdevremapkeys
75+
76+
permissions:
77+
id-token: write # IMPORTANT: mandatory for trusted publishing
78+
79+
steps:
80+
- name: Download all the dists
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: python-package-distributions
84+
path: dist/
85+
- name: Publish distribution 📦 to TestPyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1
87+
with:
88+
repository-url: https://test.pypi.org/legacy/

RUNNING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ is all handled by logind/systemd/X automatically.
3131

3232
# Software Setup
3333

34+
## Install from PyPI
35+
36+
The recommended way to install the program is to use `pipx`.
37+
38+
```bash
39+
$ pipx install evdevremapkeys
40+
```
41+
42+
You can also use `pip`, but on modern distros, `pipx` is a far better experience.
43+
3444
## Prerequisites
3545

3646
This project uses [uv](https://docs.astral.sh/uv/) to build and run. You will need to install
@@ -66,6 +76,9 @@ or
6676
$ pipx install <source-tarball>
6777
```
6878

79+
If you are trying to do active developing, installing with `--editable` will cause the
80+
installation to always reflect your changes.
81+
6982
## Building a self-contained executable
7083

7184
You will not usually need a self-contained executable, given the existing options for running

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "evdevremapkeys"
3-
version = "0.1"
3+
version = "1.0.0"
44
keywords = ["evdev", "uinput"]
55
description = "A daemon to remap key events on linux input devices"
66
readme = "README.md"

0 commit comments

Comments
 (0)