Files
court-pilot/.github/workflows/release.yml
T

281 lines
7.7 KiB
YAML

name: Build and Release Court Pilot
on:
push:
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CN_APPLICATION: 'trweb/court-pilot'
jobs:
# ---------------------------------------------------------
# Create CrabNebula draft release
# ---------------------------------------------------------
draft:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Create CrabNebula draft release
uses: crabnebula-dev/cloud-release@v0
with:
command: release draft ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
# ---------------------------------------------------------
# Windows Tauri build
# ---------------------------------------------------------
windows:
needs: draft
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
- name: Install dependencies
run: npm ci
- name: Install Ionic CLI
run: npm install -g @ionic/cli
- name: Build Tauri app
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: npm run tauri build
- name: Upload Windows packages as GitHub artifact
uses: actions/upload-artifact@v4
with:
name: court-pilot-windows
if-no-files-found: error
path: |
src-tauri/target/release/bundle/msi/*.msi
src-tauri/target/release/bundle/nsis/*.exe
- name: Upload release assets to CrabNebula
uses: crabnebula-dev/cloud-release@v0
with:
command: release upload ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri
# ---------------------------------------------------------
# macOS Tauri builds (Apple Silicon and Intel)
# ---------------------------------------------------------
macos:
needs: draft
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
cache: true
- name: Install dependencies
run: npm ci
- name: Install Ionic CLI
run: npm install -g @ionic/cli
- name: Build Tauri macOS packages
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: npm run tauri build -- --target ${{ matrix.target }} --bundles app,dmg
- name: Upload macOS packages as GitHub artifact
uses: actions/upload-artifact@v4
with:
name: court-pilot-macos-${{ matrix.target }}
if-no-files-found: error
path: src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
- name: Upload release assets to CrabNebula
uses: crabnebula-dev/cloud-release@v0
with:
command: release upload ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri
# ---------------------------------------------------------
# Linux Tauri build + Snap
# ---------------------------------------------------------
snap:
needs: draft
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libssl-dev \
libxdo-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libwebkit2gtk-4.1-dev \
dpkg
- name: Install dependencies
run: npm ci
- name: Install Ionic CLI
run: npm install -g @ionic/cli
- name: Build Tauri Debian package
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: npm run tauri build -- --bundles deb
- name: Extract Debian package
run: |
rm -rf snap-root
mkdir -p snap-root
dpkg -x src-tauri/target/release/bundle/deb/*.deb snap-root/
- name: Show extracted Snap filesystem
run: |
echo "Snap root:"
find snap-root -maxdepth 5 -type f | sort
- name: Build Snap
uses: snapcore/action-build@v1
id: snapcraft
with:
snapcraft-channel: stable
- name: Show generated Snap
run: |
echo "Snap created:"
echo "${{ steps.snapcraft.outputs.snap }}"
- name: Upload Snap as GitHub artifact
uses: actions/upload-artifact@v4
with:
name: court-pilot-snap
path: ${{ steps.snapcraft.outputs.snap }}
- name: Publish Snap to Snap Store
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: stable
# ---------------------------------------------------------
# Publish CrabNebula release
# ---------------------------------------------------------
publish:
needs:
- windows
- macos
- snap
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Publish CrabNebula release
uses: crabnebula-dev/cloud-release@v0
with:
command: release publish ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri
working-directory: ./src-tauri
# ---------------------------------------------------------
# Publish GitHub release after CrabNebula publication succeeds
# ---------------------------------------------------------
github-release:
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download release packages
uses: actions/download-artifact@v4
with:
pattern: court-pilot-*
path: release-assets
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
shell: bash
run: |
mapfile -d '' assets < <(find release-assets -type f -print0)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release packages found" >&2
exit 1
fi
gh release create "$RELEASE_TAG" "${assets[@]}" \
--verify-tag \
--title "$RELEASE_TAG" \
--generate-notes