refactor: remove unwanted code & improve preload plugin #345
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - release/* | |
| workflow_dispatch: | |
| 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: 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: 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/ |