Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

chore: fixing ci/cd

Gabriel Steinb403c5990443
diff --git a/.github/workflows/build-and-notarize.yml b/.github/workflows/build-and-notarize.yml
index 9bcbefa68..0f0b8516a 100644
--- a/.github/workflows/build-and-notarize.yml
+++ b/.github/workflows/build-and-notarize.yml
@@ -72,9 +72,10 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# Enable signing only for macOS non-PR builds
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os == 'macos-latest' && github.event_name != 'pull_request' && 'true' || 'false' }}
- # Notarization credentials (only used on macOS)
+ # Notarization credentials (electron-builder required names)
+ APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
- APPLE_API_KEY_ISSUER_ID: ${{ secrets.APPLE_API_KEY_ISSUER_ID }}
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload Artifacts
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index 1b9fc2a0c..000000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Build Cross-Platform
-
-on:
- push:
- branches: [ main, develop ]
- pull_request:
- branches: [ main ]
- workflow_dispatch:
-
-jobs:
- build:
- strategy:
- matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
- include:
- - os: ubuntu-latest
- build_cmd: npm run build:linux
- - os: windows-latest
- build_cmd: npm run build:win
- - os: macos-latest
- build_cmd: npm run build:mac
-
- runs-on: ${{ matrix.os }}
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Build for ${{ matrix.os }}
- run: ${{ matrix.build_cmd }}
- env:
- CSC_IDENTITY_AUTO_DISCOVERY: false
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.os }}-build
- path: dist/
- retention-days: 7
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9571a958c..442a29d25 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,16 +3,77 @@ name: Release
on:
push:
tags:
- - 'v*'
+ - 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version to release (e.g., 1.0.0)'
+ required: true
+ type: string
jobs:
- release:
+ create-release:
+ runs-on: ubuntu-latest
+ outputs:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ version: ${{ steps.get_version.outputs.version }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Get version
+ id: get_version
+ run: |
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+ VERSION="v${{ github.event.inputs.version }}"
+ else
+ VERSION="${{ github.ref_name }}"
+ fi
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ - name: Create Draft Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ steps.get_version.outputs.version }}
+ release_name: OpenWhispr ${{ steps.get_version.outputs.version }}
+ draft: true # Creates as draft - you manually publish when ready
+ prerelease: false
+ body: |
+ ## What's New
+ -
+
+ ## Bug Fixes
+ -
+
+ ## Downloads
+ Download the appropriate version for your platform below.
+
+ ### Installation Instructions
+
+ **macOS**: Download the .dmg file, open it, and drag OpenWhispr to Applications
+ **Windows**: Download and run the .exe installer
+ **Linux**: Download the .AppImage and make it executable
+
+ ---
+ *Note: macOS builds are signed and notarized by Apple*
+
+ build-and-release:
+ needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
+ include:
+ - os: macos-latest
+ build_cmd: npm run build:mac
+ - os: ubuntu-latest
+ build_cmd: npm run build:linux
+ - os: windows-latest
+ build_cmd: npm run build:win
steps:
- uses: actions/checkout@v4
@@ -26,16 +87,106 @@ jobs:
- name: Install dependencies
run: npm ci
- - name: Build and Release
+ # macOS code signing setup (same as build workflow)
+ - name: Setup macOS Code Signing
+ if: matrix.os == 'macos-latest'
+ env:
+ APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
+ run: |
+ # Create temp directory for certificates
+ CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
+ API_KEY_PATH=$RUNNER_TEMP/api_key.p8
+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
+
+ # Decode certificates from secrets
+ echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH
+ echo "$APPLE_API_KEY_BASE64" | base64 --decode > $API_KEY_PATH
+
+ # Create temporary keychain
+ security create-keychain -p "runner" $KEYCHAIN_PATH
+ security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
+ security unlock-keychain -p "runner" $KEYCHAIN_PATH
+
+ # Import certificate to keychain
+ security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
+ security list-keychain -d user -s $KEYCHAIN_PATH
+
+ # Allow codesign to use the certificate
+ security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
+
+ # Export API key path for electron-builder
+ echo "APPLE_API_KEY_PATH=$API_KEY_PATH" >> $GITHUB_ENV
+
+ - name: Update package.json version
+ run: |
+ VERSION="${{ needs.create-release.outputs.version }}"
+ VERSION="${VERSION#v}" # Remove 'v' prefix
+ npm version $VERSION --no-git-tag-version
+
+ - name: Build Application
+ run: ${{ matrix.build_cmd }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- CSC_IDENTITY_AUTO_DISCOVERY: false
- run: npm run dist -- --publish always
-
- - name: Upload artifacts
- uses: actions/upload-artifact@v4
- if: always()
+ # Enable signing for macOS
+ CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os == 'macos-latest' && 'true' || 'false' }}
+ # Notarization credentials (electron-builder required names)
+ APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+
+ - name: Upload Release Assets
+ uses: actions/github-script@v7
with:
- name: ${{ matrix.os }}-release
- path: dist/
- retention-days: 7
\ No newline at end of file
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const fs = require('fs');
+ const path = require('path');
+
+ const distPath = path.join(process.cwd(), 'dist');
+ const files = fs.readdirSync(distPath);
+
+ // Define which files to upload based on OS
+ const patterns = {
+ 'macos-latest': ['.dmg', '.zip'],
+ 'ubuntu-latest': ['.AppImage', '.deb'],
+ 'windows-latest': ['.exe']
+ };
+
+ const osPatterns = patterns['${{ matrix.os }}'] || [];
+ const filesToUpload = files.filter(file =>
+ osPatterns.some(pattern => file.endsWith(pattern))
+ );
+
+ // Extract release ID from upload URL
+ const uploadUrl = '${{ needs.create-release.outputs.upload_url }}';
+ const releaseId = uploadUrl.match(/\/releases\/(\d+)/)[1];
+
+ for (const file of filesToUpload) {
+ const filePath = path.join(distPath, file);
+ const fileContent = fs.readFileSync(filePath);
+
+ console.log(`Uploading ${file}...`);
+
+ await github.rest.repos.uploadReleaseAsset({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ release_id: parseInt(releaseId),
+ name: file,
+ data: fileContent,
+ headers: {
+ 'content-type': 'application/octet-stream',
+ 'content-length': fileContent.length
+ }
+ });
+ }
+
+ # Security cleanup
+ - name: Cleanup Certificates
+ if: always() && matrix.os == 'macos-latest'
+ run: |
+ security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
+ rm -f $RUNNER_TEMP/build_certificate.p12
+ rm -f $RUNNER_TEMP/api_key.p8
\ No newline at end of file
diff --git a/scripts/notarize.js b/scripts/notarize.js
index dada91fe9..a080c00ab 100644
--- a/scripts/notarize.js
+++ b/scripts/notarize.js
@@ -22,7 +22,7 @@ exports.default = async function notarizing(context) {
try {
// Use API key if available (CI/CD), otherwise use keychain (local)
- const useApiKey = process.env.APPLE_API_KEY_ID && process.env.APPLE_API_KEY_ISSUER_ID;
+ const useApiKey = process.env.APPLE_API_KEY_ID && process.env.APPLE_API_ISSUER;
await notarize({
tool: 'notarytool',
@@ -32,7 +32,7 @@ exports.default = async function notarizing(context) {
teamId: process.env.APPLE_TEAM_ID,
appleApiKey: process.env.APPLE_API_KEY_PATH,
appleApiKeyId: process.env.APPLE_API_KEY_ID,
- appleApiIssuer: process.env.APPLE_API_KEY_ISSUER_ID,
+ appleApiIssuer: process.env.APPLE_API_ISSUER,
} : {
// Local with keychain profile
keychainProfile: 'openwispr-profile',