Skip to content

Release

Release #27

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
args: ""
rust_target: x86_64-unknown-linux-gnu
- platform: windows-latest
args: ""
rust_target: x86_64-pc-windows-msvc
- platform: macos-latest
args: "--target aarch64-apple-darwin"
rust_target: aarch64-apple-darwin
- platform: macos-latest
args: "--target x86_64-apple-darwin"
rust_target: x86_64-apple-darwin
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libssl-dev patchelf
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "lts/*"
cache: "npm"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
targets: ${{ matrix.rust_target }}
- name: Rust cache
uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: src-tauri
- name: Install frontend dependencies
run: npm ci
- name: Configure Windows code signing
if: matrix.platform == 'windows-latest'
shell: pwsh
env:
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: |
if (-not $env:WINDOWS_CERTIFICATE) {
Write-Host "No Windows signing certificate configured, skipping..."
exit 0
}
New-Item -ItemType Directory -Force -Path certificate | Out-Null
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
certutil -decode certificate/tempCert.txt certificate/certificate.pfx | Out-Null
Remove-Item certificate/tempCert.txt
$securePassword = ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText
$cert = Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password $securePassword
$config = Get-Content src-tauri/tauri.conf.json -Raw | ConvertFrom-Json
$config.bundle | Add-Member -Force -MemberType NoteProperty -Name windows -Value ([pscustomobject]@{
certificateThumbprint = $cert.Thumbprint
digestAlgorithm = 'sha256'
timestampUrl = 'http://timestamp.digicert.com'
})
$config | ConvertTo-Json -Depth 100 | Set-Content src-tauri/tauri.conf.json
- name: Build and publish
id: tauri_build
uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: "SQLPilot ${{ github.ref_name }}"
releaseBody: |
## Downloads
| Platform | File |
|----------|------|
| Windows (portable) | `SQLPilot.exe` |
| Windows (installer) | `.msi` or `-setup.exe` |
| macOS (Apple Silicon) | `aarch64.dmg` |
| macOS (Intel) | `x64.dmg` |
| Linux | `.deb` or `.AppImage` |
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
- name: Upload portable exe (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$exe = "src-tauri/target/release/sqlpilot.exe"
$dest = "SQLPilot.exe"
Copy-Item $exe $dest
gh release upload ${{ github.ref_name }} $dest --clobber
generate-update-manifest:
name: Generate update manifest
needs: [build]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "lts/*"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Download release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release download ${{ github.ref_name }}
- name: Sign artifacts and generate manifest
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
# Generate signatures for each platform binary
for file in *.AppImage *.deb *.rpm *.msi *.exe *.dmg *.tar.gz; do
[ -f "$file" ] || continue
echo "Signing $file..."
npx tauri signer sign "$file"
done
rm -f /tmp/sign-key
# Build the manifest JSON
echo "{" > update-manifest.json
echo " \"version\": \"$VERSION\"," >> update-manifest.json
echo " \"notes\": \"See https://github.com/EVWorth/sqlpilot/releases/tag/$TAG\"," >> update-manifest.json
echo " \"pub_date\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"," >> update-manifest.json
echo " \"platforms\": {" >> update-manifest.json
first=true
for sigfile in *.sig; do
[ -f "$sigfile" ] || continue
base="${sigfile%.sig}"
case "$base" in
*_amd64.AppImage) key="linux-x86_64" ;;
*_amd64.deb) key="linux-deb" ;;
*_x64_en-US.msi) key="windows-x86_64" ;;
*_x64-setup.exe) key="windows-x86_64-nsis" ;;
*_x64.dmg) key="darwin-x86_64" ;;
*_aarch64.dmg) key="darwin-aarch64" ;;
*) echo "Unknown platform for $sigfile, skipping..." ; continue ;;
esac
# Build download URL matching GitHub's asset naming
url="https://github.com/EVWorth/sqlpilot/releases/download/$TAG/$base"
sig=$(cat "$sigfile")
$first || echo "," >> update-manifest.json
echo " \"$key\": {" >> update-manifest.json
echo " \"url\": \"$url\"," >> update-manifest.json
echo " \"signature\": \"$sig\"" >> update-manifest.json
echo " }" >> update-manifest.json
first=false
done
echo " }" >> update-manifest.json
echo "}" >> update-manifest.json
echo "Generated manifest:"
cat update-manifest.json
mv update-manifest.json latest.json
- name: Upload update manifest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.ref_name }} latest.json --clobber