Files
shark/.github/workflows/build-linux.yml
2025-10-02 23:30:31 -04:00

77 lines
2.6 KiB
YAML

name: 'build-linux'
on: workflow_dispatch
jobs:
build-linux:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
# Set up Bun
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
### Check if version changed
- name: Check version
id: check-version
run: |
# Get the current version
CURRENT_VERSION=$(grep -o '"version": *"[^"]*"' package.json | head -1 | cut -d'"' -f4)
echo "Current version: $CURRENT_VERSION"
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "changed=true" >> $GITHUB_OUTPUT
# Install Rust with proper targets for Linux
- name: Install Rust stable
if: steps.check-version.outputs.changed == 'true'
uses: dtolnay/rust-toolchain@stable
with:
targets: 'x86_64-unknown-linux-gnu'
# Cache Rust dependencies for faster builds
- name: Rust cache
if: steps.check-version.outputs.changed == 'true'
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
# Install frontend dependencies
- name: Install frontend dependencies
if: steps.check-version.outputs.changed == 'true'
run: bun install
# Sync version from package.json to tauri.conf.json
- name: Sync version to tauri.conf.json
if: steps.check-version.outputs.changed == 'true'
run: |
VERSION="${{ steps.check-version.outputs.version }}"
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
echo "Updated tauri.conf.json to version $VERSION"
# Install system dependencies for Linux builds
- name: Install system dependencies
if: steps.check-version.outputs.changed == 'true'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# Run Tauri build with verbose logging
- name: Build with Tauri
if: steps.check-version.outputs.changed == 'true'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --target x86_64-unknown-linux-gnu --verbose
tagName: v${{ steps.check-version.outputs.version }}
releaseName: "Shark v${{ steps.check-version.outputs.version }}"
releaseDraft: false
prerelease: false