Skip to content

feat: enhance release workflow to include standalone Linux binary pac… #15

feat: enhance release workflow to include standalone Linux binary pac…

feat: enhance release workflow to include standalone Linux binary pac… #15

Workflow file for this run

name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
env:
APP_NAME: fetch-github-hosts
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Create draft release
id: create
uses: actions/github-script@v7
with:
script: |
const tagName = context.ref.replace('refs/tags/', '') || 'v4.0';
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: `Fetch Github Hosts ${tagName}`,
body: `See the assets below to download the app for your platform.\n\n**macOS**: \`.dmg\` (Universal binary - supports both Intel & Apple Silicon)\n**Windows**: \`.msi\` / \`.exe\`\n**Linux**: \`.deb\` / \`.AppImage\`\n**Linux Standalone Binary**: \`.tar.gz\` (amd64 / aarch64, no installation needed)`,
draft: true,
prerelease: false
});
return data.id;
result-encoding: string
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# macOS - Universal binary (Intel + Apple Silicon)
- platform: macos-latest
args: --target universal-apple-darwin
rust_targets: aarch64-apple-darwin,x86_64-apple-darwin
name: macos-universal
# Linux x86_64
- platform: ubuntu-22.04
args: ''
rust_targets: ''
name: linux-x86_64
# Linux ARM64
- platform: ubuntu-22.04-arm
args: ''
rust_targets: ''
name: linux-aarch64
# Windows
- platform: windows-latest
args: ''
rust_targets: ''
name: windows-x86_64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_targets }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install system dependencies (Linux)
if: contains(matrix.name, 'linux')
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
pkg-config \
libglib2.0-dev \
libgtk-3-dev \
libgdk-pixbuf2.0-dev \
libpango1.0-dev \
libatk1.0-dev \
libcairo-gobject2 \
libjavascriptcoregtk-4.1-dev
- name: Install frontend dependencies
run: npm ci
- name: Build static frontend
run: npx cross-env NUXT_CLI_WRAPPER=false npx nuxt generate
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.args }}
- name: Package standalone binary (Linux)
if: contains(matrix.name, 'linux')
run: |
ARCH=$([[ "${{ matrix.name }}" == *"aarch64"* ]] && echo "aarch64" || echo "amd64")
BINARY="src-tauri/target/release/fetch-github-hosts"
TAR_NAME="fetch-github-hosts_linux_${ARCH}.tar.gz"
tar -czf "$TAR_NAME" -C "$(dirname "$BINARY")" "$(basename "$BINARY")"
echo "TAR_NAME=$TAR_NAME" >> "$GITHUB_ENV"
- name: Upload standalone binary (Linux)
if: contains(matrix.name, 'linux')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
gh release upload "$TAG_NAME" "$TAR_NAME" --repo "${{ github.repository }}" --clobber