Add back abstract and title previews #18
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
name: Build PyQt5 App | |
on: | |
push: | |
branches: [ main ] | |
env: | |
POETRY_VERSION: 1.4.1 | |
PACKAGE_NAME: metaanalyser | |
PACKAGE_VERSION: 0.1.0 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: [3.11.1] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Setup Python environment | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install system libraries for Linux | |
- name: Install Linux system libraries | |
if: runner.os == 'Linux' | |
run: sudo apt-get update && sudo apt-get install -y xvfb x11-utils libxkbcommon-x11-0 | |
# Install Poetry | |
- name: Install Poetry on Linux | |
if: runner.os == 'Linux' | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }} | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install Poetry on Windows | |
if: runner.os == 'Windows' | |
run: | | |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python3 - --version ${{ env.POETRY_VERSION }} | |
echo "$env:APPDATA\Python\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Install Chrome for Playwright (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
export PLAYWRIGHT_BROWSERS_PATH=0 | |
poetry run playwright install chromium | |
- name: Install Chrome for Playwright (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$env:PLAYWRIGHT_BROWSERS_PATH="0" | |
poetry run playwright install chromium | |
# Build PyQt5 app binary with PyInstaller | |
- name: Build with PyInstaller | |
run: | | |
poetry run pyinstaller --onefile --name ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }} app/main.py | |
# Package the binary | |
- name: Package Binary on Linux | |
if: runner.os == 'Linux' | |
run: tar czvf ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_linux.tar.gz -C dist ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }} | |
- name: Package Binary on Windows | |
if: runner.os == 'Windows' | |
run: Compress-Archive -Path .\dist\${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}.exe -DestinationPath .\${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_windows.zip | |
# Upload the packaged binary as an artifact for Linux | |
- name: Upload Linux Binary as Artifact | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: linux-binary | |
path: '*.tar.gz' | |
# Upload the packaged binary as an artifact for Windows | |
- name: Upload Windows Binary as Artifact | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: windows-binary | |
path: '*.zip' | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download all compiled artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: ./artifacts | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
Changes in this Release | |
- First release | |
- Not feature complete! Just a basic scaffold | |
draft: true | |
prerelease: true | |
- name: Upload Release Asset for Linux | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/linux-binary/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_linux.tar.gz | |
asset_name: ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_linux.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset for Windows | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/windows-binary/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_windows.zip | |
asset_name: ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_windows.zip | |
asset_content_type: application/zip |