Skip to content

feat: connect Tauri dev to WPF main-ready channel #327

feat: connect Tauri dev to WPF main-ready channel

feat: connect Tauri dev to WPF main-ready channel #327

Workflow file for this run

on:
push:
branches:
- main
- dev
- release/*
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: build-${{ matrix.platform }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
include:
- platform: windows
os: windows-2022
shell: bash
tauri_args: ""
- platform: macos
os: macos-latest
shell: sh
tauri_args: --target universal-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: true
- name: Prepare environment variables
run: |
echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
echo "APP_VERSION=`node -p "require('./loader/package.json').version"`" >> $GITHUB_ENV
- name: Setup MSBuild
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Setup Rust build cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "loader/src-tauri -> target"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
- recursive: true
- name: Build preload plugins
run: |
cd plugins
pnpm build
- name: Build core (windows)
if: runner.os == 'Windows'
run: msbuild.exe pengu.sln -t:build -p:Configuration=Release -p:Platform=x64
- name: Build core (macos)
if: runner.os == 'macOS'
run: make release
- name: Build loader
uses: tauri-apps/tauri-action@v0
with:
projectPath: "loader"
args: ${{ matrix.tauri_args }}
- name: Move loader output (windows)
if: runner.os == 'Windows'
run: |
cp "loader/src-tauri/target/release/Pengu Loader.exe" bin/
- name: Test channel switch target (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$test = Start-Process ".\bin\Pengu Loader.exe" -ArgumentList "--self-test-update-channel" -Wait -PassThru
if ($test.ExitCode -ne 0) {
Get-Content "$env:TEMP\PenguLoader-channel-self-test.log" -ErrorAction SilentlyContinue
exit $test.ExitCode
}
- name: Package Windows dev release
if: runner.os == 'Windows' && github.event_name == 'push' && github.ref_name == 'dev'
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist
Set-Content bin/version "${{ env.APP_VERSION }}+${{ env.SHORT_SHA }}+dev" -NoNewline
Compress-Archive -Path "bin/Pengu Loader.exe",bin/core.dll,bin/version -DestinationPath "dist/pengu-v${{ env.APP_VERSION }}-dev-windows.zip" -Force
- name: Create DMG distro (macos)
if: runner.os == 'macOS'
run: |
brew install create-dmg
cp bin/core.dylib "loader/src-tauri/target/universal-apple-darwin/release/bundle/macos/Pengu Loader.app/Contents/MacOS"
cp bin/insert_dylib "loader/src-tauri/target/universal-apple-darwin/release/bundle/macos/Pengu Loader.app/Contents/MacOS"
create-dmg \
--volname "Pengu Loader" \
--icon-size 100 \
--icon "Pengu Loader.app" 150 150 \
--app-drop-link 350 150 \
"bin/pengu-v${{ env.APP_VERSION }}-universal.dmg" \
"loader/src-tauri/target/universal-apple-darwin/release/bundle/macos/Pengu Loader.app"
- name: Package macOS dev release
if: runner.os == 'macOS' && github.event_name == 'push' && github.ref_name == 'dev'
run: |
mkdir -p dist
cp "bin/pengu-v${{ env.APP_VERSION }}-universal.dmg" "dist/pengu-v${{ env.APP_VERSION }}-dev-macos.dmg"
- name: Upload release files
if: github.event_name == 'push' && github.ref_name == 'dev'
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.platform }}
path: dist/*
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: pengu-v${{ env.APP_VERSION }}-dev-${{ env.SHORT_SHA }}-${{ matrix.platform }}
path: |
bin/
!bin/obj/
release:
if: github.event_name == 'push' && github.ref_name == 'dev'
needs: build
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download release files
uses: actions/download-artifact@v4
with:
pattern: release-*
path: dist
merge-multiple: true
- name: Publish Dev release
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(node -p "require('./loader/package.json').version")
tag="v${version}-dev.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}"
previous=$(gh api "repos/$GITHUB_REPOSITORY/releases?per_page=100" --jq 'map(select(.draft == false and .prerelease == true and (.tag_name | contains("-dev."))))[0].tag_name // empty')
notes_flags=(--generate-notes)
if [ -n "$previous" ]; then
notes_flags+=(--notes-start-tag "$previous")
fi
gh release create "$tag" dist/* \
--target "$GITHUB_SHA" \
--title "Pengu Loader v${version} Tauri Dev" \
--prerelease \
--latest=false \
"${notes_flags[@]}"