Build and Publish #3
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@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.REPO_SCOPED_TOKEN }} | |
- 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: Build executable with PyInstaller | |
run: | | |
python tools/create_exe.py | |
Compress-Archive -Path dist/* -Destination release.zip | |
dir | |
- name: Upload zipped exe to release | |
uses: JasonEtco/upload-to-release@master | |
with: | |
args: release.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
pypi-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
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@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |