Skip to content

Minor styling fixes, remove limiter for offline version, fix sound da… #240

Minor styling fixes, remove limiter for offline version, fix sound da…

Minor styling fixes, remove limiter for offline version, fix sound da… #240

Workflow file for this run

name: Build portable Electron versions
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
issues: write
actions: read
checks: write
jobs:
vite-build:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Set up Node.js
uses: actions/setup-node@main
with:
node-version: "21"
- name: Install Dependencies
run: npm ci --force
- name: Build Vite App
run: npm run vitebuildcli
- name: Upload Vite Build Artifact
uses: actions/upload-artifact@main
with:
name: vite-dist
path: ./dist
build:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: macos-latest
arch: [x64, arm64]
- os: windows-latest
arch: [x64, arm64]
runs-on: ${{ matrix.os }}
needs: vite-build
outputs:
mac_x64_artifact_id: ${{ steps.upload-mac-x64.outputs.artifact-id }}
mac_arm64_artifact_id: ${{ steps.upload-mac-arm64.outputs.artifact-id }}
win_x64_artifact_id: ${{ steps.upload-win-x64.outputs.artifact-id }}
win_arm64_artifact_id: ${{ steps.upload-win-arm64.outputs.artifact-id }}
linux_x64_artifact_id: ${{ steps.upload-linux-x64.outputs.artifact-id }}
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Download Vite Build Artifact
uses: actions/download-artifact@main
with:
name: vite-dist
path: ./dist
- name: Get version from package.json
id: get_version
run: |
echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@main
with:
node-version: "21"
- name: Cache Node.js dependencies
uses: actions/cache@main
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Set up Python (macOS only)
if: matrix.os == 'macos-latest'
uses: actions/setup-python@main
with:
python-version: "3.12"
- name: Cache Python dependencies (macOS only)
if: matrix.os == 'macos-latest'
uses: actions/cache@main
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache Electron build (all platforms)
uses: actions/cache@main
with:
path: |
${{ github.workspace }}/.electron
${{ github.workspace }}/.cache/electron
${{ github.workspace }}/.cache/electron-builder
key: ${{ runner.os }}-electron-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-electron-cache-
- name: Install Python virtual environment (macOS only)
if: matrix.os == 'macos-latest'
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools
- name: Ensure package-lock.json is up to date
run: npm install --force
env:
CI: true
- name: Install dependencies (Ubuntu and macOS)
if: matrix.os != 'windows-latest'
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
source venv/bin/activate
npm install appdmg --save-dev --force
fi
npm ci --force
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: npm ci --force
- name: Build Electron app (macOS)
if: matrix.os == 'macos-latest'
run: |
source venv/bin/activate
for arch in ${{ join(matrix.arch, ' ') }}; do
npm run makecli -- --arch=$arch
mkdir -p out/make-mac-$arch
mv out/make/* out/make-mac-$arch/
done
- name: Build Electron app (Windows)
if: matrix.os == 'windows-latest'
run: |
$architectures = @("x64", "arm64")
foreach ($arch in $architectures) {
npm run makecli -- --arch=$arch
New-Item -ItemType Directory -Force -Path "out/make-win-$arch"
Move-Item -Path "out/make/*" -Destination "out/make-win-$arch/"
}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Build Electron app (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
npm run makecli
mkdir -p out/make-linux
mv out/make/* out/make-linux/
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Upload Artifacts (macOS x64)
if: matrix.os == 'macos-latest' && contains(matrix.arch, 'x64')
id: upload-mac-x64
uses: actions/upload-artifact@main
with:
name: iSpeakerReact-macos-x64
path: out/make-mac-x64
- name: Upload Artifacts (macOS arm64)
if: matrix.os == 'macos-latest' && contains(matrix.arch, 'arm64')
id: upload-mac-arm64
uses: actions/upload-artifact@main
with:
name: iSpeakerReact-macos-arm64
path: out/make-mac-arm64
- name: Upload Artifacts (Windows x64)
if: matrix.os == 'windows-latest' && contains(matrix.arch, 'x64')
id: upload-win-x64
uses: actions/upload-artifact@main
with:
name: iSpeakerReact-windows-x64
path: out/make-win-x64
- name: Upload Artifacts (Windows arm64)
if: matrix.os == 'windows-latest' && contains(matrix.arch, 'arm64')
id: upload-win-arm64
uses: actions/upload-artifact@main
with:
name: iSpeakerReact-windows-arm64
path: out/make-win-arm64
- name: Upload Artifacts (Linux x64)
if: matrix.os == 'ubuntu-latest'
id: upload-linux-x64
uses: actions/upload-artifact@main
with:
name: iSpeakerReact-linux-x64
path: out/make-linux
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Download all build artifacts
uses: actions/download-artifact@main
with:
path: ./release
- name: Get version from package.json
id: get_version
run: |
echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
- name: Get latest tag
id: get_tag
run: |
latest_tag=$(git tag | sort -V | tail -n 1)
if [ -z "$latest_tag" ]; then
new_tag="v${{ env.PACKAGE_VERSION }}"
else
random_str=$(openssl rand -hex 4)
version_prefix=${{ env.PACKAGE_VERSION }}
new_tag="${version_prefix}-${random_str}"
fi
echo "LATEST_TAG=$new_tag" >> $GITHUB_ENV
- name: Create tag
run: |
git tag ${{ env.LATEST_TAG }}
git push origin ${{ env.LATEST_TAG }}
- name: Create GitHub release
id: create_release
uses: softprops/action-gh-release@c43d7637b9b9ce3e953168c325d27253a5d48d8e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.LATEST_TAG }}
name: v${{ env.PACKAGE_VERSION }}
body: |
Release version ${{ env.PACKAGE_VERSION }} of the project.
- name: Display the release directory structure
run: ls -R ./release
- name: Upload Release Assets
run: |
for artifact in ./release/iSpeakerReact-*; do
if [ -d "$artifact" ]; then
find "$artifact" -type f -print0 | while IFS= read -r -d '' file; do
if [[ "$file" == *"RELEASES"* || "$file" == *.nupkg ]]; then
echo "Skipping $file"
continue
fi
echo "Attempting to upload: $file"
if gh release upload "${{ env.LATEST_TAG }}" "$file" --clobber; then
echo "Successfully uploaded: $file"
else
echo "Failed to upload: $file"
fi
done
else
echo "No artifact found in $artifact"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}