[MLV] Fix tag prefix in workflow #1
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
# make sure to generate requirements.txt with pipreqs first! | ||
name: Build | ||
on: | ||
push: | ||
tags: | ||
- 'MLV-v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
workflow_dispatch: | ||
jobs: | ||
# see https://data-dive.com/multi-os-deployment-in-cloud-using-pyinstaller-and-github-actions/ | ||
# but here we build first and run our createrelease job afterwards, accessing the artifacts of our build job | ||
build: | ||
name: Build packages | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: macos-latest | ||
TARGET: macos | ||
#--volicon "Hello World.icns" \ | ||
# for the dmg stuff, see https://www.pythonguis.com/tutorials/packaging-pyqt5-applications-pyinstaller-macos-dmg/ | ||
CMD_BUILD: > | ||
pyinstaller --clean --log-level DEBUG --name "LogViewer" --add-data "src/LogViewer/data:LogViewer/data" --add-data "src/shared/ui/*.ui:shared/ui" --add-data "src/LogViewer/ui/*.ui:LogViewer/ui" --specpath src --windowed --icon src/LogViewer/data/art/icon.png --onefile --debug bootloader --argv-emulation src/LogViewer.py && | ||
cd dist/ && | ||
zip -r9 LogViewer LogViewer.app/ && | ||
brew install create-dmg && | ||
mkdir -p dmg && | ||
cp -vr "LogViewer.app" dmg/ && | ||
create-dmg --volname "LogViewer" --volicon LogViewer.app/Contents/Resources/generated-* --window-pos 200 120 --window-size 600 300 --icon-size 100 --icon "LogViewer.app" 175 120 --hide-extension "LogViewer.app" --app-drop-link 425 120 "LogViewer.dmg" "./dmg/" | ||
OUT_FILE_NAME: LogViewer.dmg | ||
ASSET_MIME: application/binary | ||
- os: windows-latest | ||
TARGET: windows | ||
CMD_BUILD: > | ||
pyinstaller --clean --log-level DEBUG --name "LogViewer" --add-data "src/LogViewer/data;LogViewer/data" --add-data "src/shared/ui/*.ui;shared/ui" --add-data "src/LogViewer/ui/*.ui;LogViewer/ui" --specpath src --windowed --icon src/LogViewer/data/art/icon.png --onefile --debug bootloader src/LogViewer.py | ||
OUT_FILE_NAME: LogViewer.exe | ||
ASSET_MIME: application/vnd.microsoft.portable-executable | ||
- os: ubuntu-latest | ||
TARGET: linux | ||
#sudo apt install plasma-integration -y && | ||
#sudo cp -av /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme.so /opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/PyQt5/Qt5/plugins/platformthemes/ -f && | ||
#--add-binary "/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/KDEPlasmaPlatformTheme.so:PyQt5/Qt5/plugins/platformthemes" | ||
#--add-binary "/lib/x86_64-linux-gnu/libz.so.1:." | ||
CMD_BUILD: > | ||
pyinstaller --clean --log-level DEBUG --name "LogViewer" --add-data "src/LogViewer/data:LogViewer/data" --add-data "src/shared/ui/*.ui:shared/ui" --add-data "src/LogViewer/ui/*.ui:LogViewer/ui" --specpath src --windowed --icon src/LogViewer/data/art/icon.png --onefile src/LogViewer.py | ||
OUT_FILE_NAME: LogViewer | ||
ASSET_MIME: application/x-executable | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11 | ||
# requirements.txt was created using pipreqs | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade pyinstaller | ||
pip install --upgrade pyinstaller-hooks-contrib | ||
pip install --upgrade Pillow | ||
pip install --upgrade tk | ||
pip install --upgrade tcl | ||
pip install --upgrade -r src/requirements.txt | ||
- name: Extract version string | ||
run: echo "VERSION='${{ github.ref_name }}'" >src/LogViewer/utils/version.py | ||
- name: Build with pyinstaller for ${{matrix.TARGET}} | ||
run: ${{matrix.CMD_BUILD}} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.OUT_FILE_NAME}} | ||
path: ./dist/${{ matrix.OUT_FILE_NAME}} # or path/to/artifact | ||
createrelease: | ||
name: Create Release | ||
runs-on: [ubuntu-latest] | ||
needs: build | ||
steps: | ||
- name: Load build artifacts | ||
uses: actions/download-artifact@v3 | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
tag_name: ${{ github.ref }} | ||
target_commitish: master | ||
generate_release_notes: true | ||
body: | | ||
New release | ||
files: | | ||
LogViewer*/* | ||
fail_on_unmatched_files: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||