Эх сурвалжийг харах

added build and release action

UwU 1 өдөр өмнө
parent
commit
c72ff4adf9

+ 105 - 0
.github/workflows/build.yml

@@ -0,0 +1,105 @@
+name: Build
+
+on:
+  push:
+    branches: [main]
+    tags: ['v*']
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  steamworks-vote:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v5
+
+      - uses: actions/setup-node@v5
+        with:
+          node-version: 22
+
+      - name: Install clang for bindgen
+        run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
+
+      - name: Build patched steamworks.js
+        env:
+          STEAMWORKSJS_BUILD: build
+        run: bash patches/steamworks-vote/build.sh "$RUNNER_TEMP/src"
+
+      - name: Pack
+        run: |
+          mkdir -p "$RUNNER_TEMP/out"
+          cd "$RUNNER_TEMP/src/steamworksjs"
+          npm pack --pack-destination "$RUNNER_TEMP/out"
+          cp dist/linux64/steamworksjs.linux-x64-gnu.node dist/linux64/libsteam_api.so "$RUNNER_TEMP/out/"
+
+      - uses: actions/upload-artifact@v4
+        with:
+          name: steamworks-vote
+          path: ${{ runner.temp }}/out/*
+          if-no-files-found: error
+
+  we-manager:
+    needs: steamworks-vote
+    # still build the app when the patch build breaks, it just falls back to unconfirmed votes then
+    if: ${{ !cancelled() }}
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v5
+
+      - uses: actions/setup-node@v5
+        with:
+          node-version: 22
+          cache: npm
+
+      - run: npm ci
+
+      - uses: actions/download-artifact@v4
+        if: ${{ needs.steamworks-vote.result == 'success' }}
+        with:
+          name: steamworks-vote
+          path: ${{ runner.temp }}/steamworks-vote
+
+      - name: Use patched steamworks.js
+        if: ${{ needs.steamworks-vote.result == 'success' }}
+        run: npm install --no-save "$RUNNER_TEMP"/steamworks-vote/steamworks.js-*.tgz
+
+      - run: npm run build
+
+      - run: npx electron-builder --linux --publish never
+
+      - uses: actions/upload-artifact@v4
+        with:
+          name: we-manager
+          path: |
+            dist/*.AppImage
+            dist/*.deb
+          if-no-files-found: error
+
+  release:
+    needs: [steamworks-vote, we-manager]
+    if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+    steps:
+      - uses: actions/checkout@v5
+
+      - name: Check tag matches package.json version
+        run: |
+          version=$(node -p "require('./package.json').version")
+          if [ "v$version" != "$GITHUB_REF_NAME" ]; then
+            echo "tag $GITHUB_REF_NAME does not match package.json version $version"
+            exit 1
+          fi
+
+      - uses: actions/download-artifact@v4
+        with:
+          path: release
+          merge-multiple: true
+
+      - name: Create release
+        env:
+          GH_TOKEN: ${{ github.token }}
+        run: |
+          gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes \
+            release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz 2>/dev/null)

+ 3 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "we-manager",
-  "version": "0.7.3",
+  "version": "0.7.4",
   "type": "module",
   "description": "Wallpaper Engine workshop manager",
   "author": "UwU <260361707+WallpaperEngineLover@users.noreply.github.com>",
@@ -72,5 +72,6 @@
       "out/**/*",
       "node_modules/**/*"
     ]
-  }
+  },
+  "homepage": "https://github.com/WallpaperEngineLover/we_manager"
 }

+ 3 - 2
patches/steamworks-vote/build.sh

@@ -4,6 +4,7 @@
 #
 # Usage: ./build.sh [path-to-projects-dir]
 # Defaults to ~/projects/private if no argument is given (matches this project's usual layout).
+# STEAMWORKSJS_BUILD=build makes a release build instead of the default debug one.
 set -euo pipefail
 
 PROJECTS_DIR="${1:-$HOME/projects/private}"
@@ -17,7 +18,7 @@ if ! command -v cargo >/dev/null 2>&1; then
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
 fi
 # shellcheck disable=SC1091
-source "$HOME/.cargo/env"
+[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
 cargo --version
 
 echo "==> Cloning steamworks-rs (skipped if already present)"
@@ -58,7 +59,7 @@ fi
 echo "==> Building steamworks.js (this runs cargo + napi, may take a minute)"
 cd "$STEAMWORKSJS"
 npm install
-npm run build:debug
+npm run "${STEAMWORKSJS_BUILD:-build:debug}"
 
 echo ""
 echo "==> Done. Built artifact:"

+ 1 - 1
src/main/services/config.service.ts

@@ -282,7 +282,7 @@ export function setLweRepo(url: string | null, branch: string | null): void {
   store.set('lweRepoBranch', branch?.trim() || null)
 }
 
-/** Extra cmake arguments (e.g. "-DENABLE_KDE_EXPERIMENTAL_FEATURES=ON"), appended to the build. */
+/** Extra cmake arguments (e.g. "-DDISABLE_KDE_FEATURES=ON"), appended to the build. */
 export function getLweCmakeArgs(): string | null {
   return store.get('lweCmakeArgs')
 }

+ 3 - 3
src/main/services/lwe.service.ts

@@ -166,7 +166,7 @@ const DEPS_DEBIAN = [
   'libgl-dev', 'libglew-dev', 'freeglut3-dev', 'libsdl2-dev',
   'liblz4-dev', 'libavcodec-dev', 'libavformat-dev', 'libavutil-dev', 'libswscale-dev',
   'libxxf86vm-dev', 'libglm-dev', 'libglfw3-dev',
-  'libmpv-dev', 'mpv', 'libpulse-dev', 'libpulse0', 'libfftw3-dev',
+  'libmpv-dev', 'mpv', 'libpulse-dev', 'libpulse0', 'libfftw3-dev', 'libdbus-1-dev',
   'libwayland-dev', 'wayland-protocols', 'libegl1-mesa-dev',
   'libgmp-dev', 'patchelf'
 ]
@@ -178,7 +178,7 @@ const DEPS_FEDORA = [
   'mesa-libGL-devel', 'glew-devel', 'freeglut-devel', 'SDL2-devel',
   'lz4-devel', 'ffmpeg-free-devel',
   'libXxf86vm-devel', 'glm-devel', 'glfw-devel',
-  'mpv-devel', 'pulseaudio-libs-devel', 'fftw-devel',
+  'mpv-devel', 'pulseaudio-libs-devel', 'fftw-devel', 'dbus-devel',
   'wayland-devel', 'wayland-protocols-devel', 'mesa-libEGL-devel',
   'gmp-devel', 'patchelf'
 ]
@@ -186,7 +186,7 @@ const DEPS_FEDORA = [
 const DEPS_ARCH = [
   'base-devel', 'cmake', 'pkg-config',
   'glew', 'freeglut', 'sdl2', 'lz4', 'ffmpeg',
-  'glm', 'glfw', 'mpv', 'libpulse', 'fftw',
+  'glm', 'glfw', 'mpv', 'libpulse', 'fftw', 'dbus',
   'libxrandr', 'libxinerama', 'libxcursor', 'libxi', 'libxxf86vm',
   'wayland', 'wayland-protocols', 'mesa',
   'gmp', 'patchelf'

+ 2 - 2
src/renderer/src/components/settings/SettingsView.tsx

@@ -729,13 +729,13 @@ export default function SettingsView() {
             </div>
             <label className="block text-xs text-gray-400">Extra cmake arguments</label>
             <p className="text-xs text-gray-600">
-              Passed to cmake when configuring the build, e.g. -DENABLE_KDE_EXPERIMENTAL_FEATURES=ON
+              Passed to cmake when configuring the build, e.g. -DDISABLE_KDE_FEATURES=ON
             </p>
             <input
               type="text"
               value={lweCmakeArgs}
               onChange={(e) => { setLweCmakeArgs(e.target.value); setRepoSaved(false) }}
-              placeholder="-DENABLE_KDE_EXPERIMENTAL_FEATURES=ON"
+              placeholder="-DDISABLE_KDE_FEATURES=ON"
               className="w-full rounded-lg bg-white/5 px-3 py-2 text-sm text-gray-200 outline-none focus:ring-1 focus:ring-indigo-500 font-mono"
             />
           </div>