add build and release workflow #4
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
name: Build and Release PlatypusGui | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build and Upload Artifacts | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
# 1. Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 2. Set up the environment | |
- name: Set up CMake | |
uses: jwlawson/actions-setup-cmake@v1 | |
with: | |
cmake-version: '3.16' | |
# Linux setup | |
- name: Install dependencies on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libopencv-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libxcb1-dev | |
# macOS setup | |
- name: Install dependencies on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install qt@5 opencv libxcb | |
# Windows setup | |
- name: Install Chocolatey on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
Set-ExecutionPolicy Bypass -Scope Process -Force; ` | |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
# Install dependencies on Windows | |
- name: Install dependencies on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
choco install opencv qt5-default -y | |
# 3. Configure CMake | |
- name: Configure CMake | |
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release | |
# 4. Build the project | |
- name: Build PlatypusGui | |
run: cmake --build build --config Release | |
# 5. Archive the build output | |
- name: Archive build output | |
if: matrix.os == 'ubuntu-latest' | |
run: zip -r PlatypusGui-linux.zip build/PlatypusGui | |
- name: Archive build output | |
if: matrix.os == 'macos-latest' | |
run: zip -r PlatypusGui-mac.zip build/PlatypusGui | |
- name: Archive build output | |
if: matrix.os == 'windows-latest' | |
run: Compress-Archive -Path build\Release\PlatypusGui.exe -DestinationPath PlatypusGui-windows.zip | |
# 6. Upload artifacts for release | |
- name: Upload Release Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-platypus | |
path: | | |
PlatypusGui-linux.zip | |
PlatypusGui-mac.zip | |
PlatypusGui-windows.zip | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
PlatypusGui-linux.zip | |
PlatypusGui-mac.zip | |
PlatypusGui-windows.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |