fix: minor details #9
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 | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '.github/workflows/build.yml' | |
- 'package.json' | |
- 'src-tauri/**/*' | |
- 'src/**/*' | |
pull_request: | |
paths: | |
- '.github/workflows/build.yml' | |
- 'package.json' | |
- 'src-tauri/**/*' | |
- 'src/**/*' | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
build: | |
runs-on: ${{ matrix.config.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- platform: ubuntu-latest | |
target: 'x86_64-unknown-linux-gnu' | |
- platform: ubuntu-latest | |
target: 'aarch64-unknown-linux-gnu' | |
- platform: ubuntu-latest | |
target: 'armv7-unknown-linux-gnueabihf' | |
- platform: macos-latest | |
target: 'x86_64-apple-darwin' | |
- platform: macos-latest | |
target: 'aarch64-apple-darwin' | |
- platform: windows-latest | |
target: 'x86_64-pc-windows-msvc' | |
- platform: windows-latest | |
target: 'aarch64-pc-windows-msvc' | |
features: | |
- 'default' | |
- 'offline' | |
steps: | |
- uses: actions-rust-lang/[email protected] | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
src-tauri/target/ | |
key: ${{ runner.os }}-${{ matrix.config.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: (Linux) Install dependencies | |
if: matrix.config.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev \ | |
build-essential \ | |
curl \ | |
wget \ | |
libssl-dev \ | |
libgtk-3-dev \ | |
libayatana-appindicator3-dev \ | |
librsvg2-dev | |
- name: Add target | |
run: rustup target add ${{ matrix.config.target }} | |
- name: Install Cargo tauri CLI | |
run: cargo install tauri-cli --version "^2.0.0-beta" | |
- name: Install dependencies | |
run: pnpm install | |
- name: (Windows) If we are building the offline version, bootstrap PokeRogue locally | |
if: matrix.features == 'offline' && matrix.config.platform == 'windows-latest' | |
run: .\bootstrap_pokerogue.cmd | |
- name: (Unix) Make PokeRogue scripts executable | |
if: matrix.config.platform != 'windows-latest' | |
run: chmod +x bootstrap_pokerogue.sh | |
- name: (Unix) If we are building the offline version, bootstrap PokeRogue locally | |
if: matrix.features == 'offline' && matrix.config.platform != 'windows-latest' | |
run: ./bootstrap_pokerogue.sh | |
- name: Build | |
# If we are compiling for Windows ARM, we can only support NSIS | |
run: cargo tauri build --target ${{ matrix.config.target }} ${{ matrix.config.target == 'aarch64-pc-windows-msvc' && '--bundles nsis' || '' }} --features ${{ matrix.features }} | |
env: | |
RUSTFLAGS: -Awarnings | |
CC: clang | |
# For portable installs | |
- name: Create empty config.json | |
run: cd src-tauri/target/${{ matrix.config.target }}/release && echo {} > config.json | |
# paths: | |
# Windows: | |
# - src-tauri/target/${{ matrix.config.target }}/release/PokeRogue.exe | |
# Ubuntu: | |
# - src-tauri/target/${{ matrix.config.target }}/release/pokerogue | |
# MacOS: | |
# - src-tauri/target/${{ matrix.config.target }}/release/bundle/macos/PokeRogue.app | |
- name: (Windows) Compress build | |
if: matrix.config.platform == 'windows-latest' | |
run: cd src-tauri/target/${{ matrix.config.target }}/release && 7z a -tzip -mx9 RogueTop.zip | |
PokeRogue.exe | |
config.json | |
- name: (Linux) Compress build | |
if: matrix.config.platform == 'ubuntu-latest' | |
run: cd src-tauri/target/${{ matrix.config.target }}/release && tar -czvf roguetop.tar.gz roguetop config.json | |
# Windows portable | |
- name: (Windows) Upload portable | |
if: matrix.config.platform == 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-portable | |
path: RogueTop.zip | |
# Windows MSI | |
- name: (Windows) Upload .msi | |
if: matrix.config.platform == 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-msi | |
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/msi/*.msi | |
# Windows ARM only supports NSIS right now, but we should upload that too | |
- name: (Windows) Upload NSIS | |
if: matrix.config.platform == 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-nsis | |
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/nsis/*.exe | |
# Ubuntu portable | |
- name: (Linux) Upload portable | |
if: matrix.config.platform == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-portable | |
path: src-tauri/target/${{ matrix.config.target }}/release/roguetop.tar.gz | |
# Ubuntu deb | |
- name: (Linux) Upload .deb | |
if: matrix.config.platform == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-deb | |
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/deb/*.deb | |
- name: (Linux) Upload .appimage | |
if: matrix.config.platform == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-appimage | |
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/appimage/*.AppImage | |
- name: (MacOS) Upload .dmg | |
if: matrix.config.platform == 'macos-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: roguetop-${{ matrix.features }}-${{ matrix.config.target }}-dmg | |
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/dmg/*.dmg |