add electron gh actions workflow

This commit is contained in:
Ramnique Singh 2026-01-17 10:39:11 +05:30
parent f72dee731a
commit 0aa6f99d54

76
.github/workflows/electron-build.yml vendored Normal file
View file

@ -0,0 +1,76 @@
name: Build Electron App
on:
release:
types: [published]
permissions:
contents: write # Required to upload release assets
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'pnpm'
cache-dependency-path: 'apps/x/pnpm-lock.yaml'
- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Extracted version: ${VERSION}"
- name: Update package.json versions
run: |
node -e "
const fs = require('fs');
const version = '${{ steps.version.outputs.version }}';
// Update apps/x/package.json
const rootPackage = JSON.parse(fs.readFileSync('apps/x/package.json', 'utf8'));
rootPackage.version = version;
fs.writeFileSync('apps/x/package.json', JSON.stringify(rootPackage, null, 2) + '\n');
// Update apps/x/apps/main/package.json
const mainPackage = JSON.parse(fs.readFileSync('apps/x/apps/main/package.json', 'utf8'));
mainPackage.version = version;
fs.writeFileSync('apps/x/apps/main/package.json', JSON.stringify(mainPackage, null, 2) + '\n');
console.log('Updated version to:', version);
"
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: apps/x
- name: Build distributables
run: pnpm run make
working-directory: apps/x/apps/main
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
with:
name: distributables
path: apps/x/apps/main/out/make/*
retention-days: 30
- name: Attach files to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: apps/x/apps/main/out/make/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}