Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
128 changes: 128 additions & 0 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build Desktop App

on:
workflow_call:
inputs:
channel:
description: "Release channel (stable or canary)"
required: true
type: string
version_suffix:
description: "Version suffix to append (e.g., -canary). Empty for stable."
required: false
type: string
default: ""
electron_builder_config:
description: "Electron builder config file"
required: false
type: string
default: "electron-builder.ts"
artifact_prefix:
description: "Prefix for artifact names"
required: false
type: string
default: "desktop"
artifact_retention_days:
description: "Number of days to retain artifacts"
required: false
type: number
default: 30

jobs:
build:
name: Build - macOS (${{ matrix.arch }})
runs-on: macos-latest
environment: production

strategy:
fail-fast: false
matrix:
arch: [arm64]

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install --frozen

- name: Set version suffix
if: inputs.version_suffix != ''
working-directory: apps/desktop
run: |
# Read current version and append suffix
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION="${CURRENT_VERSION}${{ inputs.version_suffix }}"
echo "Setting version to: $NEW_VERSION"
# Update package.json version using node
node -e "
const fs = require('fs');
const pkg = require('./package.json');
pkg.version = '$NEW_VERSION';
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, '\t') + '\n');
"
echo "Updated package.json version to $NEW_VERSION"

- name: Clean dev folder
working-directory: apps/desktop
run: bun run clean:dev

- name: Compile app with electron-vite
working-directory: apps/desktop
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GH_CLIENT_ID: ${{ secrets.GH_CLIENT_ID }}
NEXT_PUBLIC_WEB_URL: ${{ secrets.NEXT_PUBLIC_WEB_URL }}
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
SENTRY_DSN_DESKTOP: ${{ secrets.SENTRY_DSN_DESKTOP }}
run: bun run compile:app

- name: Build Electron app
working-directory: apps/desktop
env:
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: bun run package -- --publish never --config ${{ inputs.electron_builder_config }}

- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_prefix }}-mac-${{ matrix.arch }}-dmg
path: apps/desktop/release/*.dmg
retention-days: ${{ inputs.artifact_retention_days }}
if-no-files-found: error

- name: Upload ZIP artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_prefix }}-mac-${{ matrix.arch }}-zip
path: apps/desktop/release/*.zip
retention-days: ${{ inputs.artifact_retention_days }}
if-no-files-found: error

- name: Upload auto-update manifest
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_prefix }}-mac-update-manifest
path: apps/desktop/release/*-mac.yml
retention-days: ${{ inputs.artifact_retention_days }}
if-no-files-found: error
Comment thread
Kitenite marked this conversation as resolved.
Resolved
111 changes: 111 additions & 0 deletions .github/workflows/release-desktop-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Release Desktop Canary

on:
schedule:
# Every 12 hours at 12 AM and 12 PM UTC
- cron: "0 0,12 * * *"
workflow_dispatch: # Manual trigger for testing

permissions:
contents: write

jobs:
check-changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check.outputs.should_build }}
short_sha: ${{ steps.check.outputs.short_sha }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
build_time: ${{ steps.check.outputs.build_time }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for changes since last canary
id: check
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT

# Capture build timestamp (works for both scheduled and manual runs)
echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

# Get the commit SHA of the last canary release
LAST_CANARY_SHA=$(git rev-parse desktop-canary 2>/dev/null || echo "")

if [ -z "$LAST_CANARY_SHA" ]; then
echo "No previous canary release found, building..."
echo "should_build=true" >> $GITHUB_OUTPUT
elif [ "$LAST_CANARY_SHA" = "$(git rev-parse HEAD)" ]; then
echo "No changes since last canary release, skipping..."
echo "should_build=false" >> $GITHUB_OUTPUT
else
echo "Changes detected since last canary, building..."
echo "should_build=true" >> $GITHUB_OUTPUT
fi

build:
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
uses: ./.github/workflows/build-desktop.yml
with:
channel: canary
version_suffix: "-canary"
electron_builder_config: electron-builder.canary.ts
artifact_prefix: desktop-canary
artifact_retention_days: 7
secrets: inherit

release:
name: Update Canary Release
needs: [check-changes, build]
if: needs.check-changes.outputs.should_build == 'true'
runs-on: ubuntu-latest

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: desktop-canary-*
merge-multiple: true

- name: List artifacts
run: |
echo "Release artifacts:"
ls -la release-artifacts/

- name: Delete existing canary release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing release if it exists
gh release delete desktop-canary --yes || true
# Delete the tag
git push origin :refs/tags/desktop-canary || true

- name: Create Canary Release
uses: softprops/action-gh-release@v2
with:
tag_name: desktop-canary
name: "Superset Desktop Canary"
body: |
**Internal Testing Build**

This is an automated canary build from `main` branch.

- Commit: ${{ github.sha }}
- Short SHA: ${{ needs.check-changes.outputs.short_sha }}
- Built: ${{ needs.check-changes.outputs.build_time }}

⚠️ This build is for internal testing only and may be unstable.
prerelease: true
files: release-artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread
Kitenite marked this conversation as resolved.
Resolved
98 changes: 9 additions & 89 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,95 +16,14 @@ permissions:

jobs:
build:
name: Build - macOS (${{ matrix.arch }})
runs-on: macos-latest
environment: production
uses: ./.github/workflows/build-desktop.yml
with:
channel: stable
electron_builder_config: electron-builder.ts
artifact_prefix: desktop
artifact_retention_days: 30
secrets: inherit

strategy:
fail-fast: false
matrix:
arch: [arm64]
# To build for Intel Macs too, uncomment:
# arch: [arm64, x64]

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install --frozen

# Run prebuild and compile steps before electron-builder
- name: Clean dev folder
working-directory: apps/desktop
run: bun run clean:dev

- name: Compile app with electron-vite
working-directory: apps/desktop
env:
NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST: ${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GH_CLIENT_ID: ${{ secrets.GH_CLIENT_ID }}
NEXT_PUBLIC_WEB_URL: ${{ secrets.NEXT_PUBLIC_WEB_URL }}
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
SENTRY_DSN_DESKTOP: ${{ secrets.SENTRY_DSN_DESKTOP }}
run: bun run compile:app

# Build the Electron app for macOS
# Uses --publish never to prevent electron-builder from creating its own release
# The release job handles GitHub release creation
- name: Build Electron app
working-directory: apps/desktop
env:
# macOS code signing and notarization
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: bun run package -- --publish never

# Upload artifacts separately to avoid nested zips
- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: desktop-mac-${{ matrix.arch }}-dmg
path: apps/desktop/release/*.dmg
retention-days: 30
if-no-files-found: error

- name: Upload ZIP artifact
uses: actions/upload-artifact@v4
with:
name: desktop-mac-${{ matrix.arch }}-zip
path: apps/desktop/release/*.zip
retention-days: 30
if-no-files-found: error

- name: Upload auto-update manifest
uses: actions/upload-artifact@v4
with:
name: desktop-mac-update-manifest
path: apps/desktop/release/latest-mac.yml
retention-days: 30
if-no-files-found: error

# Create GitHub Release after builds complete
release:
name: Create GitHub Release
needs: build
Expand All @@ -119,6 +38,7 @@ jobs:
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: desktop-*
merge-multiple: true

- name: Create stable-named copies for latest download URLs
Expand All @@ -145,7 +65,7 @@ jobs:
ls -la

- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: release-artifacts/*
draft: true
Expand Down
Loading
Loading