Skip to content

Update main.yml

Update main.yml #7

Workflow file for this run

name: Build and Package
on:
push:
branches: [main] # 根据您的需求修改分支名称
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2' # 请替换为您的 Qt 版本
host: ${{ matrix.os }}
arch: 'gcc_64' # 对于 Linux,可以指定架构
- name: Build on Linux
if: runner.os == 'Linux'
run: |
mkdir build && cd build
qmake ../LogReager.pro
make -j$(nproc)
- name: Build on macOS
if: runner.os == 'macOS'
run: |
mkdir build && cd build
qmake ../LogReager.pro
make -j$(sysctl -n hw.logicalcpu)
- name: Build on Windows
if: runner.os == 'Windows'
shell: cmd
run: |
mkdir build && cd build
qmake ..\LogReager.pro
nmake
- name: Package on Linux
if: runner.os == 'Linux'
run: |
cd build
wget -O linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod +x linuxdeployqt
./linuxdeployqt ./LogReager -appimage
- name: Package on macOS
if: runner.os == 'macOS'
run: |
cd build
/usr/local/opt/qt/bin/macdeployqt LogReager.app
- name: Package on Windows
if: runner.os == 'Windows'
shell: cmd
run: |
cd build
windeployqt LogReager.exe
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-artifact
path: |
build/**