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
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Application

on:
pull_request:
workflow_dispatch:
inputs:
target:
description: "Choose build branch"
required: true
default: "test-actions"

jobs:
build:
runs-on: ${{ matrix.os }}
environment: BUILD_APP
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || '' }}

- uses: actions/setup-node@v4
with:
node-version: 22

- run: yarn install --frozen-lockfile

- run: yarn build:package
env:
CONFIG_JSON: ${{ secrets.CONFIG_JSON }}
RENDERER_CONFIG: ${{ secrets.RENDERER_CONFIG }}
3 changes: 2 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ linux:
target:
- AppImage
- deb
- rpm
category: AudioVideo
icon: ./icons/icon.png
executableName: pulsesync
Expand All @@ -92,7 +93,7 @@ linux:
Icon: PulseSync
Terminal: false
Type: Application
Categories: AudioVideo;Audio;
Categories: Utility;
MimeType: application/x-pext;x-scheme-handler/pulsesync;

deb:
Expand Down
20 changes: 20 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,23 @@ async function sendPatchNotes(): Promise<void> {
}
}

function applyConfigFromEnv() {
const configJson = process.env.CONFIG_JSON
const rendererConfig = process.env.RENDERER_CONFIG

if (configJson) {
const configJsonPath = path.resolve(__dirname, '../src/config.json')
fs.writeFileSync(configJsonPath, configJson, 'utf-8')
log(LogLevel.SUCCESS, `Wrote ${configJsonPath}`)
}

if (rendererConfig) {
const rendererConfigPath = path.resolve(__dirname, '../src/renderer/api/config.ts')
fs.writeFileSync(rendererConfigPath, rendererConfig, 'utf-8')
log(LogLevel.SUCCESS, `Wrote ${rendererConfigPath}`)
}
}

function setConfigDevFalse() {
const configPath = path.resolve(__dirname, '../src/renderer/api/config.ts')
let content = fs.readFileSync(configPath, 'utf-8')
Expand All @@ -410,6 +427,9 @@ async function main(): Promise<void> {
await sendPatchNotes()
return
}
log(LogLevel.INFO, `CONFIG_JSON length: ${process.env.CONFIG_JSON?.length}`)
log(LogLevel.INFO, `RENDERER_CONFIG length: ${process.env.RENDERER_CONFIG?.length}`)
applyConfigFromEnv()

log(LogLevel.INFO, `Platform: ${os.platform()}, Arch: ${os.arch()}`)
log(LogLevel.INFO, `CWD: ${process.cwd()}`)
Expand Down
Loading