Files

76 lines
2.4 KiB
YAML

name: Setup App
description: Sets up Node.js, installs dependencies, and optionally builds the app.
inputs:
install-command:
description: Command used to install dependencies.
required: false
default: pnpm install --frozen-lockfile
tauri:
description: Whether to install Tauri build dependencies via mise.
required: false
default: 'false'
build:
description: Whether to build the app after installing dependencies.
required: false
default: 'false'
build-command:
description: Command used when build is enabled.
required: false
default: pnpm run build
runs:
using: composite
steps:
- name: Setup tools (mise)
id: setup-mise
uses: jdx/mise-action@9e7f7633ff6f6d6048a9418a68d48f288f50eb14 # v4.2.3
with:
cache: true
- name: Cache Rust toolchain (workaround jdx/mise-action#215)
if: ${{ inputs.tauri == 'true' }}
id: cache-rust
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.rustup/toolchains/
key: rust-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
restore-keys: rust-${{ runner.os }}-
- name: Ensure task scripts are executable
shell: bash
working-directory: ${{ github.workspace }}
run: chmod -R +x scripts/
- name: Trust project mise configuration
shell: bash
working-directory: ${{ github.workspace }}
run: mise settings set trusted_config_paths "$GITHUB_WORKSPACE"
- name: Install dependencies
shell: bash
working-directory: ${{ github.workspace }}
run: ${INPUTS_INSTALL_COMMAND}
env:
INPUTS_INSTALL_COMMAND: ${{ inputs.install-command }}
- name: Install Tauri build dependencies
if: ${{ inputs.tauri == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}
run: mise run tauri:setup
- name: Force reinstall Rust on cache mismatch
if: ${{ inputs.tauri == 'true' && steps.setup-mise.outputs.cache-hit == 'true' && steps.cache-rust.outputs.cache-hit != 'true' }}
shell: bash
working-directory: ${{ github.workspace }}
run: mise install rust --force
- name: Build app
if: ${{ inputs.build == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}
run: ${INPUTS_BUILD_COMMAND}
env:
INPUTS_BUILD_COMMAND: ${{ inputs.build-command }}