Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tauri #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/desktop-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Desktop App CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "frontend/src-tauri -> target"
cache-on-failure: true

- name: Install dependencies (macOS)
run: |
brew install openssl@3

- name: Install frontend dependencies
working-directory: ./frontend
run: bun install

- name: Install Tauri CLI
run: cargo install tauri-cli

- name: Build Tauri App (macOS)
working-directory: ./frontend
run: cargo tauri build
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}

- name: Upload macOS Build
uses: actions/upload-artifact@v4
with:
name: maple-macos
path: frontend/src-tauri/target/release/bundle/dmg/*.dmg
retention-days: 5

build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "frontend/src-tauri -> target"
cache-on-failure: true

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev

- name: Install frontend dependencies
working-directory: ./frontend
run: bun install

- name: Install Tauri CLI
run: cargo install tauri-cli

- name: Build Tauri App (Linux)
working-directory: ./frontend
run: cargo tauri build
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}

- name: Upload Linux Builds
uses: actions/upload-artifact@v4
with:
name: maple-linux
path: |
frontend/src-tauri/target/release/bundle/appimage/*.AppImage
frontend/src-tauri/target/release/bundle/deb/*.deb
retention-days: 5
136 changes: 136 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Release
on:
release:
types: [created]

jobs:
create-release:
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create-release.outputs.result }}

Comment on lines +7 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undefined Step Reference in Job Outputs:
The output property release_id (line 10) is referencing steps.create-release.outputs.result, but no step with the id create-release is defined within this job. Please add an id: create-release to the appropriate step (perhaps the one that creates the release) or update the reference to use the correct step id.

🧰 Tools
🪛 actionlint (1.7.4)

10-10: property "create-release" is not defined in object type {get_version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)

steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2

- name: Get version
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

build-tauri:
needs: create-release
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "frontend/src-tauri -> target"
cache-on-failure: true

- name: Install dependencies (macOS)
if: matrix.platform == 'macos-latest'
run: |
brew install openssl@3

- name: Install dependencies (Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev

- name: Install frontend dependencies
working-directory: ./frontend
run: bun install

- name: Build Tauri App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
projectPath: './frontend'
tagName: ${{ github.ref_name }}
releaseName: 'Maple v${{ github.ref_name }}'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false

update-latest-json:
needs: build-tauri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download release artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p artifacts
gh release download ${{ github.ref_name }} -D artifacts

- name: Generate latest.json
id: generate-latest
run: |
VERSION="${{ github.ref_name }}"
RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

# Get signatures from the artifacts
MACOS_ARM_SIG=$(cat artifacts/*.app.tar.gz.sig)
MACOS_X64_SIG=$(cat artifacts/*.app.tar.gz.sig)
LINUX_X64_SIG=$(cat artifacts/*.AppImage.sig)
Comment on lines +105 to +108
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Verify Artifact Signature Retrieval Logic
Both the ARM and x86_64 macOS signature variables are set using the same file pattern (artifacts/*.app.tar.gz.sig). Please verify if the same signature file is intended for both architectures. If not, adjust the file patterns accordingly to retrieve the correct signatures for MACOS_ARM_SIG and MACOS_X64_SIG.


cat > latest.json << EOF
{
"version": "${VERSION#v}",
"notes": "See the release notes at https://github.com/OpenSecret/maple/releases/tag/${VERSION}",
"pub_date": "${RELEASE_DATE}",
"platforms": {
"darwin-x86_64": {
"signature": "${MACOS_X64_SIG}",
"url": "https://github.com/OpenSecret/maple/releases/download/${VERSION}/Maple.app.tar.gz"
},
"darwin-aarch64": {
"signature": "${MACOS_ARM_SIG}",
"url": "https://github.com/OpenSecret/maple/releases/download/${VERSION}/Maple.app.tar.gz"
},
"linux-x86_64": {
"signature": "${LINUX_X64_SIG}",
"url": "https://github.com/OpenSecret/maple/releases/download/${VERSION}/maple.AppImage"
}
}
}
EOF

- name: Upload latest.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} latest.json --clobber
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,95 @@
# Maple AI Frontend

Uses [bun](https://bun.sh/) for development.
Uses [bun](https://bun.sh/) for development and [Tauri](https://tauri.app/) for desktop app builds.

## Prerequisites

1. Install [Bun](https://bun.sh/):
```bash
curl -fsSL https://bun.sh/install | bash
```

2. Install Rust and its dependencies:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

3. Install system dependencies:

### macOS
```bash
xcode-select --install
```

### Linux (Ubuntu/Debian)
```bash
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
```

## Development

1. Install dependencies:
```bash
bun install
```

2. Start the development server:
```bash
# For web development only
bun run dev

# For desktop app development
bun tauri dev
```

Expects a `VITE_OPEN_SECRET_API_URL` environment variable to be set. (See `.env.example`)

## Building

To build the desktop application:
```bash
bun tauri build
```

## Releases

### Setting up Signing Keys
1. Generate a new signing key:
```bash
cargo tauri signer generate
```
This will create the tauri public and private key.


2. Add the public key to `src-tauri/tauri.conf.json` in the `updater.pubkey` field
3. Add the private key to GitHub Actions secrets:
- Go to repository Settings → Secrets and variables → Actions
- Create a new secret named `TAURI_SIGNING_PRIVATE_KEY`
- Paste the private key from the tauri command.

### Creating a Release
1. Update the version in `src-tauri/tauri.conf.json`
2. Create a new release in GitHub:
- Go to Releases → Draft a new release
- Create a new tag (e.g., `v0.1.0`)
- Set a release title and description
- Publish the release

The GitHub Actions workflow will automatically:
- Build the app for all platforms
- Sign the builds
- Upload the artifacts to the release
- Create and upload `latest.json` for auto-updates

## Updating PCR0 values

If there's a new version of the enclave pushed to staging or prod, append the new PCR0 value to the `pcr0Values` or `pcr0DevValues` arrays in `frontend/src/app.tsx`.
Loading
Loading