From 9af2827d801436bf879bae9f99c54d3a18a7437b Mon Sep 17 00:00:00 2001 From: akarachen Date: Tue, 3 Feb 2026 11:50:36 +0800 Subject: [PATCH 1/2] ci: add GitHub Actions workflows for multi-platform builds - Add CI workflow for pull requests (lint, typecheck, build) - Add Release workflow for tag-based releases - Support platforms: macOS (arm64), Windows (x64, arm64), Linux (x64, arm64) - Auto-detect pre-release versions (alpha, beta, rc) - Upload artifacts to GitHub Releases Co-Authored-By: Claude Opus 4.5 --- .github/workflows/ci.yml | 74 +++++++++++++++ .github/workflows/release.yml | 167 ++++++++++++++++++++++++++++++++++ package.json | 16 +++- 3 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cb43cb8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + pull_request: + branches: [master] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint-and-typecheck: + name: Lint & Typecheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm typecheck + + - run: pnpm lint + + build: + name: Build (${{ matrix.os }}) + needs: lint-and-typecheck + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + platform: mac + artifact-name: mac-arm64 + - os: windows-latest + platform: win + artifact-name: win-x64 + - os: ubuntu-latest + platform: linux + artifact-name: linux-x64 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm build:electron + + - run: pnpm dist:${{ matrix.platform }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }}-pr-${{ github.event.pull_request.number }} + path: | + release/*.dmg + release/*.zip + release/*.exe + release/*.AppImage + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..27fe70a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,167 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + prepare: + name: Prepare Release + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + is-prerelease: ${{ steps.version.outputs.is-prerelease }} + steps: + - name: Parse version from tag + id: version + run: | + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#v}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + if [[ "$VERSION" =~ (alpha|beta|rc) ]]; then + echo "is-prerelease=true" >> $GITHUB_OUTPUT + else + echo "is-prerelease=false" >> $GITHUB_OUTPUT + fi + + lint-and-typecheck: + name: Lint & Typecheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm typecheck + + - run: pnpm lint + + build-mac: + name: Build macOS (arm64) + needs: [prepare, lint-and-typecheck] + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm build:electron + + - run: pnpm dist:mac + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/upload-artifact@v4 + with: + name: mac-arm64 + path: | + release/*.dmg + release/*.zip + release/latest-mac.yml + + build-windows: + name: Build Windows (${{ matrix.arch }}) + needs: [prepare, lint-and-typecheck] + strategy: + fail-fast: false + matrix: + arch: [x64, arm64] + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm build:electron + + - run: pnpm dist:win-${{ matrix.arch }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/upload-artifact@v4 + with: + name: win-${{ matrix.arch }} + path: | + release/*.exe + release/latest.yml + + build-linux: + name: Build Linux (${{ matrix.arch }}) + needs: [prepare, lint-and-typecheck] + strategy: + fail-fast: false + matrix: + arch: [x64, arm64] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + + - run: pnpm build:electron + + - run: pnpm dist:linux-${{ matrix.arch }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/upload-artifact@v4 + with: + name: linux-${{ matrix.arch }} + path: | + release/*.AppImage + release/latest-linux.yml + + release: + name: Create GitHub Release + needs: [prepare, build-mac, build-windows, build-linux] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: r2modmanplusplus v${{ needs.prepare.outputs.version }} + prerelease: ${{ needs.prepare.outputs.is-prerelease == 'true' }} + generate_release_notes: true + files: | + artifacts/**/*.dmg + artifacts/**/*.zip + artifacts/**/*.exe + artifacts/**/*.AppImage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 613603b..30046a4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,12 @@ "preview:electron": "electron-vite preview", "dist": "pnpm build:electron && electron-builder", "dist:win": "pnpm build:electron && electron-builder --win", - "dist:mac": "pnpm build:electron && electron-builder --mac" + "dist:mac": "pnpm build:electron && electron-builder --mac", + "dist:linux": "pnpm build:electron && electron-builder --linux", + "dist:win-x64": "pnpm build:electron && electron-builder --win --x64", + "dist:win-arm64": "pnpm build:electron && electron-builder --win --arm64", + "dist:linux-x64": "pnpm build:electron && electron-builder --linux --x64", + "dist:linux-arm64": "pnpm build:electron && electron-builder --linux --arm64" }, "dependencies": { "@base-ui/react": "^1.1.0", @@ -87,21 +92,22 @@ "out/**/*", "package.json" ], + "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", "mac": { "target": [ - "dmg", - "zip" + { "target": "dmg", "arch": ["arm64"] }, + { "target": "zip", "arch": ["arm64"] } ], "category": "public.app-category.utilities" }, "win": { "target": [ - "nsis" + { "target": "nsis", "arch": ["x64", "arm64"] } ] }, "linux": { "target": [ - "AppImage" + { "target": "AppImage", "arch": ["x64", "arm64"] } ], "category": "Utility" } From c12026ff6405ab75cbe43b5d30e813fbfd107dfa Mon Sep 17 00:00:00 2001 From: akarachen Date: Tue, 3 Feb 2026 12:05:04 +0800 Subject: [PATCH 2/2] ci: run lint/typecheck in parallel with builds - Remove serial dependency on lint-and-typecheck for build jobs - All jobs run in parallel for faster CI - Release job still requires all checks to pass Co-Authored-By: Claude Opus 4.5 --- .github/workflows/ci.yml | 1 - .github/workflows/release.yml | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb43cb8..51dd617 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,6 @@ jobs: build: name: Build (${{ matrix.os }}) - needs: lint-and-typecheck strategy: fail-fast: false matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27fe70a..6863eb7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: build-mac: name: Build macOS (arm64) - needs: [prepare, lint-and-typecheck] + needs: prepare runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -79,7 +79,7 @@ jobs: build-windows: name: Build Windows (${{ matrix.arch }}) - needs: [prepare, lint-and-typecheck] + needs: prepare strategy: fail-fast: false matrix: @@ -112,7 +112,7 @@ jobs: build-linux: name: Build Linux (${{ matrix.arch }}) - needs: [prepare, lint-and-typecheck] + needs: prepare strategy: fail-fast: false matrix: @@ -145,7 +145,7 @@ jobs: release: name: Create GitHub Release - needs: [prepare, build-mac, build-windows, build-linux] + needs: [prepare, lint-and-typecheck, build-mac, build-windows, build-linux] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v4