diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..e6fff71 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,102 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + workflow_dispatch: + +jobs: + verify: + name: Verify (build + tests) + runs-on: ubuntu-latest + + steps: + - name: Checkout + 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: Run tests (if present) + run: npm run test --if-present + + - name: Build + run: npm run build + + package: + name: Package (${{ matrix.name }}) + needs: verify + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + include: + - name: Windows + os: windows-latest + platform: win + arch: x64 + artifact_glob: release/*.exe + - name: Linux + os: ubuntu-latest + platform: linux + arch: x64 + artifact_glob: release/*.AppImage + + steps: + - name: Checkout + 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 app bundles + run: npm run build + + - name: Build installers + env: + CSC_IDENTITY_AUTO_DISCOVERY: "false" + run: npx electron-builder --${{ matrix.platform }} --${{ matrix.arch }} --publish never + + - name: Upload installer artifact + uses: actions/upload-artifact@v4 + with: + name: 5ET-D-${{ matrix.platform }}-${{ github.sha }} + path: ${{ matrix.artifact_glob }} + if-no-files-found: error + + macos_source: + name: Package (macOS arm64 source) + needs: verify + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create source archive for macOS arm64 users + run: | + mkdir -p release + git archive --format=tar.gz --output="release/5ET-D-macos-arm64-source-${GITHUB_SHA::7}.tar.gz" HEAD + + - name: Upload macOS source artifact + uses: actions/upload-artifact@v4 + with: + name: 5ET-D-macos-arm64-source-${{ github.sha }} + path: release/5ET-D-macos-arm64-source-*.tar.gz + if-no-files-found: error diff --git a/README.md b/README.md index b172021..41a8e32 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,22 @@ npm run dist This command installs `electron-builder` on demand via `npx` for packaging, rather than during every local dependency install. +## macOS arm64 (source release workflow) + +If macOS runners are unavailable in CI, publish the `5ET-D-macos-arm64-source-*` artifact and have Apple Silicon users build locally: + +```bash +./build-macos-arm64.command +``` + +Equivalent CLI command: + +```bash +./scripts/build-macos-arm64.sh +``` + +This builds a macOS arm64 package and writes output to `release/`. + ## Notes - The app starts an internal local HTTP server for wiki content. diff --git a/build-macos-arm64.command b/build-macos-arm64.command new file mode 100755 index 0000000..2c1de23 --- /dev/null +++ b/build-macos-arm64.command @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +cd "${SCRIPT_DIR}" + +./scripts/build-macos-arm64.sh diff --git a/package.json b/package.json index e5ba319..2f44e27 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "dev:web": "concurrently -k \"npm:dev:main\" \"npm:dev:renderer:web\" \"npm:dev:electron:web\"", "start": "npm run build && node scripts/run-electron.cjs .", "pack": "npm run build && npx electron-builder --dir", - "dist": "npm run build && npx electron-builder" + "dist": "npm run build && npx electron-builder", + "dist:mac:arm64": "npm run build && CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder --mac --arm64 --publish never" }, "dependencies": { "electron": "40.6.0", diff --git a/scripts/build-macos-arm64.sh b/scripts/build-macos-arm64.sh new file mode 100755 index 0000000..69a3598 --- /dev/null +++ b/scripts/build-macos-arm64.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" + +cd "${REPO_ROOT}" + +echo "Building 5ET-D for macOS arm64..." +echo "Working directory: ${REPO_ROOT}" + +npm ci +npm run dist:mac:arm64 + +echo "Done. Check the release/ directory for the macOS arm64 artifact."