Skip to content

Build and Release App #3

Build and Release App

Build and Release App #3

name: Build and Release App
on:
release:
types: [published]
workflow_dispatch: # Ability to manually trigger the workflow
inputs:
tag:
description: "Tag name for the release" # used when running manually
required: true
type: string
jobs:
build-server-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall onnxruntime
pip install onnxruntime-directml
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir dist/PictoPy_Server/images
robocopy app dist\PictoPy_Server\app /e
if ($LASTEXITCODE -le 1) { exit 0 }
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
tar -a -c -f PictoPy-Windows.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Windows
path: backend/dist/PictoPy_Server/PictoPy-Windows.zip
build-server-ubuntu:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall onnxruntime
pip install onnxruntime-gpu
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir -p dist/PictoPy_Server/images
mkdir -p dist/PictoPy_Server/app
cp -r app/* dist/PictoPy_Server/app/
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
zip -r PictoPy-Ubuntu.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Ubuntu
path: backend/dist/PictoPy_Server/PictoPy-Ubuntu.zip
build-server-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir -p dist/PictoPy_Server/images
mkdir -p dist/PictoPy_Server/app
cp -r app/* dist/PictoPy_Server/app/
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
zip -r PictoPy-MacOS.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-MacOS
path: backend/dist/PictoPy_Server/PictoPy-MacOS.zip
build-sync-microservice-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
robocopy app dist\PictoPy_Sync\app /e
if ($LASTEXITCODE -le 1) { exit 0 }
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
tar -a -c -f PictoPy-Sync-Windows.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-Windows
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Windows.zip
build-sync-microservice-ubuntu:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
mkdir -p dist/PictoPy_Sync/app
cp -r app/* dist/PictoPy_Sync/app/
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
zip -r PictoPy-Sync-Ubuntu.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-Ubuntu
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Ubuntu.zip
build-sync-microservice-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
mkdir -p dist/PictoPy_Sync/app
cp -r app/* dist/PictoPy_Sync/app/
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
zip -r PictoPy-Sync-MacOS.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-MacOS
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-MacOS.zip
publish-tauri:
permissions:
contents: write
needs:
[
build-server-windows,
build-server-ubuntu,
build-server-macos,
build-sync-microservice-windows,
build-sync-microservice-ubuntu,
build-sync-microservice-macos,
]
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
args: "--target aarch64-apple-darwin"
server-artifact: "PictoPy-MacOS"
sync-artifact: "PictoPy-Sync-MacOS"
- platform: "ubuntu-22.04"
args: ""
server-artifact: "PictoPy-Ubuntu"
sync-artifact: "PictoPy-Sync-Ubuntu"
- platform: "windows-latest"
args: ""
server-artifact: "PictoPy-Windows"
sync-artifact: "PictoPy-Sync-Windows"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Create dist directories
shell: bash
run: |
mkdir -p backend/dist
mkdir -p sync-microservice/dist
- name: Download and extract server artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.server-artifact }}
path: backend/dist
- name: Download and extract sync microservice artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.sync-artifact }}
path: sync-microservice/dist
- name: Extract server files
shell: bash
run: |
cd backend/dist
unzip -o *.zip
rm *.zip
ls -l
- name: Extract sync microservice files
shell: bash
run: |
cd sync-microservice/dist
unzip -o *.zip
rm *.zip
ls -l
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin' || '' }}
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: |
cd frontend
npm install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY}}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
projectPath: ./frontend
tagName: ${{ github.event.release.tag_name || github.event.inputs.tag }}
includeUpdaterJson: true
releaseId: ${{ github.event.release.id || '' }}
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}