Update changelog and version #124
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
# Workflow for building pyinstaller packages for windows, MacOS and Ubuntu and | |
# creating a (pre-)release | |
# see https://data-dive.com/multi-os-deployment-in-cloud-using-pyinstaller-and-github-actions | |
# | |
# The workflow runs: | |
# - for push events on the main branch or when manually triggered, | |
# creating a "latest" pre-release | |
# - for tagged release events, creating a versioned release | |
# | |
# The latter requires a workflow like: | |
# | |
# * <update version.py> # PyPI version number is created from this | |
# * git tag v0.4.5 # create new local tag | |
# * git push # push to origin (without tag) | |
# * git push origin --tags # push tag to origin | |
# * <draft a release on Github from tag, select prerelease or release> | |
# | |
# Tags can be deleted with: | |
# | |
# git tag -d <tag_name> | |
# git push --delete origin <tag_name> | |
# or git push origin :<tag_name> | |
--- | |
name: build_pyinstaller | |
on: | |
push: | |
branches: main | |
release: | |
types: [published] | |
workflow_dispatch: | |
# workflow_run: | |
# workflows: ['build_flatpak'] | |
# types: | |
# - completed | |
jobs: | |
build: | |
name: Build packages | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# --- | |
- os: windows-latest | |
# --- | |
TARGET: windows | |
CMD_BUILD: > | |
pyinstaller pyfdax.spec && | |
mv dist/pyfdax.exe dist/pyfdax_win.exe | |
OUT_FILE_NAME: pyfdax_win.exe | |
ASSET_MIME: application/vnd.microsoft.portable-executable | |
# --- | |
- os: macos-latest | |
# --- | |
TARGET: macos | |
CMD_BUILD: > | |
pyinstaller pyfdax.spec && | |
mv dist/pyfdax dist/pyfdax_osx | |
OUT_FILE_NAME: pyfdax_osx # .app # pyfda.zip | |
ASSET_MIME: application/zip | |
# --- | |
- os: ubuntu-latest | |
# --- | |
TARGET: ubuntu | |
CMD_BUILD: > | |
pyinstaller pyfdax.spec && | |
mv dist/pyfdax dist/pyfdax_linux | |
OUT_FILE_NAME: pyfdax_linux | |
ASSET_MIME: application/x-executable | |
steps: | |
- name: Infos about github trigger event and ref | |
run: | | |
echo github.event_name: ${{ github.event_name }} | |
echo github.ref: ${{ github.ref }} | |
echo github.ref_type: ${{ github.ref_type }} | |
echo github.ref_name: ${{ github.ref_name }} | |
# Example result for tagged release: | |
# github.event_name: release | |
# github.ref: refs/tags/v0.8.0a3 | |
# github.ref_type: tag | |
# github.ref_name: v0.8.0a3 | |
- uses: actions/checkout@v4 | |
with: | |
ref: main # enforce using main branch | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller pyinstaller-hooks-contrib | |
- name: Build with pyinstaller for ${{matrix.TARGET}} | |
run: ${{matrix.CMD_BUILD}} | |
- name: Upload builds as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.OUT_FILE_NAME}} | |
path: ./dist/${{ matrix.OUT_FILE_NAME}} | |
release: | |
name: Release packages | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
path: ./dist | |
# not specifying the file names downloads all artifacts. However, | |
# an individual directory is created for each file identical to its name | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Update Github prerelease latest | |
if: success() && github.ref_type != 'tag' | |
uses: pyTooling/Actions/releaser@main | |
with: | |
tag: latest | |
rm: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
./dist/pyfdax_win.exe/pyfdax_win.exe | |
./dist/pyfdax_osx/pyfdax_osx | |
./dist/pyfdax_linux/pyfdax_linux | |
- name: Update versioned release | |
if: success() && github.ref_type == 'tag' | |
uses: pyTooling/Actions/releaser@main | |
with: | |
tag: ${{ github.ref_name }} | |
rm: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
./dist/pyfdax_win.exe/pyfdax_win.exe | |
./dist/pyfdax_osx/pyfdax_osx | |
./dist/pyfdax_linux/pyfdax_linux | |