-
-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (139 loc) · 4.31 KB
/
python-publish.yml
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
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# It will also use PyInstaller to create a Windows executable and upload it to the GitHub release
name: Build and Publish
on:
release:
types: [published]
jobs:
windows-build:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
git submodule update --init --recursive
python -m pip install --upgrade pip
pip install PyInstaller wheel
if (Test-Path requirements.txt) {pip install -r requirements.txt}
- name: Install simonsays
run: |
pip install ./pynput_local
pip install .
- name: Build executable with PyInstaller
run: |
python tools/create_exe.py
Compress-Archive -Path dist/* -Destination windows_release.zip
dir
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: release-executable-windows-zip
path: windows_release.zip
linux-build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
git submodule update --init --recursive
python -m pip install --upgrade pip
pip install PyInstaller wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install simonsays
run: |
pip install ./pynput_local
pip install .
- name: Build executable with PyInstaller
run: |
python tools/create_exe.py
tar -czvf linux_release.tar.gz dist/*
dir
- name: Generate blocklist
run: |
python tools/hashnames.py
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: release-executable-linux-zip
path: linux_release.tar.gz
- name: Upload Blocklist
uses: actions/upload-artifact@v4
with:
name: blocklist
path: blocklist
executable-upload:
runs-on: ubuntu-latest
needs: [windows-build, linux-build]
permissions:
contents: write
steps:
- name: Download windows executable for job windows-build
uses: actions/download-artifact@v4
with:
name: release-executable-windows-zip
- name: Download linux executable for job linux-build
uses: actions/download-artifact@v4
with:
name: release-executable-linux-zip
- name: Download blocklist
uses: actions/download-artifact@v4
with:
name: blocklist
- name: Upload zipped windows executable to release
uses: JasonEtco/upload-to-release@master
with:
args: windows_release.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload tarballed linux executable to release
uses: JasonEtco/upload-to-release@master
with:
args: linux_release.tar.gz application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload blocklist
uses: JasonEtco/upload-to-release@master
with:
args: blocklist text/plain
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pypi-publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build PyInstaller wheel
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}