2.0.2 Smooth #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@v4 | |
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@v3 | |
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@v4 | |
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@v3 | |
with: | |
name: release-executable-linux-zip | |
path: linux_release.tar.gz | |
- name: Upload Blocklist | |
uses: actions/upload-artifact@v3 | |
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@v3 | |
with: | |
name: release-executable-windows-zip | |
- name: Download linux executable for job linux-build | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-executable-linux-zip | |
- name: Download blocklist | |
uses: actions/download-artifact@v3 | |
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@v4 | |
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@b7f401de30cb6434a1e19f805ff006643653240e | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |