update workflow

This commit is contained in:
2025-07-07 17:57:14 +03:00
parent 81852859ca
commit 7449a209fb

View File

@@ -1,4 +1,5 @@
name: AstralRinth App build name: AstralRinth App build
on: on:
push: push:
branches: branches:
@@ -7,7 +8,7 @@ on:
tags: tags:
- 'v*' - 'v*'
paths: paths:
- .github/workflows/theseus-build.yml - .github/workflows/astralrinth-build.yml
- 'apps/app/**' - 'apps/app/**'
- 'apps/app-frontend/**' - 'apps/app-frontend/**'
- 'packages/app-lib/**' - 'packages/app-lib/**'
@@ -15,30 +16,25 @@ on:
- 'packages/assets/**' - 'packages/assets/**'
- 'packages/ui/**' - 'packages/ui/**'
- 'packages/utils/**' - 'packages/utils/**'
workflow_dispatch:
inputs: env:
sign-windows-binaries: SIGN_WINDOWS_BINARIES: true
description: Sign Windows binaries
type: boolean
default: true
required: false
jobs: jobs:
build: build:
name: Build name: Build
runs-on: ${{ matrix.platform }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [macos-latest, windows-latest, ubuntu-22.04] platform: [ubuntu, windows, macos]
include: include:
- platform: macos-latest - platform: ubuntu
artifact-target-name: universal-apple-darwin
- platform: windows-latest
artifact-target-name: x86_64-pc-windows-msvc
- platform: ubuntu-22.04
artifact-target-name: x86_64-unknown-linux-gnu artifact-target-name: x86_64-unknown-linux-gnu
- platform: windows
runs-on: ${{ matrix.platform }} artifact-target-name: x86_64-pc-windows-msvc
- platform: macos
artifact-target-name: universal-apple-darwin
steps: steps:
- name: 📥 Check out code - name: 📥 Check out code
@@ -49,8 +45,7 @@ jobs:
- name: 🧰 Setup Rust toolchain - name: 🧰 Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
rustflags: '' target: ${{ matrix.artifact-target-name }}
target: ${{ startsWith(matrix.platform, 'macos') && 'x86_64-apple-darwin' || '' }}
- name: 🧰 Install pnpm - name: 🧰 Install pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@@ -62,28 +57,15 @@ jobs:
cache: pnpm cache: pnpm
- name: 🧰 Install Linux build dependencies - name: 🧰 Install Linux build dependencies
if: startsWith(matrix.platform, 'ubuntu') if: matrix.platform == 'ubuntu'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -yq libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev xdg-utils openjdk-11-jdk sudo apt-get install -yq \
libwebkit2gtk-4.1-dev \
- name: 🧰 Setup Dasel libayatana-appindicator3-dev \
uses: jaxxstorm/action-install-gh-release@v2.1.0 librsvg2-dev \
with: xdg-utils \
repo: TomWright/dasel openjdk-11-jdk
tag: v2.8.1
extension-matching: disable
rename-to: ${{ startsWith(matrix.platform, 'windows') && 'dasel.exe' || 'dasel' }}
chmod: 0755
- name: ⚙️ Set application version
shell: bash
env:
APP_VERSION: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('v1.0.0-canary+{0}', github.sha) }}
run: |
dasel put -f apps/app/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version'
dasel put -f packages/app-lib/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version'
dasel put -f apps/app-frontend/package.json -t string -v "${APP_VERSION#v}" 'version'
- name: 💨 Setup Turbo cache - name: 💨 Setup Turbo cache
uses: rharkor/caching-for-turbo@v1.8 uses: rharkor/caching-for-turbo@v1.8
@@ -91,15 +73,11 @@ jobs:
- name: 🧰 Install dependencies - name: 🧰 Install dependencies
run: pnpm install run: pnpm install
- name: ✍️ Set up Windows code signing - name: ✍️ Set up Windows code signing (jsign)
if: startsWith(matrix.platform, 'windows') if: matrix.platform == 'windows' && env.SIGN_WINDOWS_BINARIES == 'true'
shell: bash shell: bash
run: | run: |
if [ '${{ startsWith(github.ref, 'refs/tags/v') || inputs.sign-windows-binaries }}' = 'true' ]; then choco install jsign --ignore-dependencies
choco install jsign --ignore-dependencies # GitHub runners come with a global Java installation already
else
dasel delete -f apps/app/tauri-release.conf.json 'bundle.windows.signCommand'
fi
- name: 🗑️ Clean up cached bundles - name: 🗑️ Clean up cached bundles
shell: bash shell: bash
@@ -108,24 +86,25 @@ jobs:
rm -rf target/*/release/bundle || true rm -rf target/*/release/bundle || true
- name: 🔨 Build macOS app - name: 🔨 Build macOS app
if: matrix.platform == 'macos'
run: pnpm --filter=@modrinth/app run tauri build --target universal-apple-darwin --config tauri-release.conf.json run: pnpm --filter=@modrinth/app run tauri build --target universal-apple-darwin --config tauri-release.conf.json
if: startsWith(matrix.platform, 'macos')
env: env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- name: 🔨 Build Linux app - name: 🔨 Build Linux app
if: matrix.platform == 'ubuntu'
run: pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json run: pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json
if: startsWith(matrix.platform, 'ubuntu')
env: env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- name: 🔨 Build Windows app - name: 🔨 Build Windows app
if: matrix.platform == 'windows'
shell: pwsh
run: | run: |
$env:JAVA_HOME = "$env:JAVA_HOME_11_X64" $env:JAVA_HOME = "$env:JAVA_HOME_11_X64"
pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json --verbose --bundles 'nsis' pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json --verbose --bundles 'nsis'
if: startsWith(matrix.platform, 'windows')
env: env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}