From 968dde5778a3db82b0a3d9a618dd246122297af2 Mon Sep 17 00:00:00 2001 From: Francesco Saverio Cannizzaro Date: Mon, 25 Dec 2023 23:57:36 +0100 Subject: [PATCH] update build / workflows --- .github/workflows/build-plugin.yaml | 43 +----------------- .github/workflows/pr-build.yaml | 63 -------------------------- .github/workflows/publish-package.yaml | 43 ++++++------------ plugin/package.json | 1 + plugin/rollup.config.mjs | 14 +++++- pnpm-lock.yaml | 7 +++ 6 files changed, 35 insertions(+), 136 deletions(-) delete mode 100644 .github/workflows/pr-build.yaml diff --git a/.github/workflows/build-plugin.yaml b/.github/workflows/build-plugin.yaml index c0f79b9..9d3705c 100644 --- a/.github/workflows/build-plugin.yaml +++ b/.github/workflows/build-plugin.yaml @@ -3,7 +3,7 @@ on: workflow_dispatch: jobs: - build-win-plugin: + build-solo-mode: runs-on: windows-latest defaults: run: @@ -17,19 +17,7 @@ jobs: - uses: actions-rs/cargo@v1.0.1 with: command: build - args: --manifest-path rust/Cargo.toml --release - - - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --manifest-path solo-mode-service/Cargo.toml --release - - - name: Temporary store plugin - uses: actions/upload-artifact@v3 - with: - name: com.dim.streamdeck.exe - path: ./rust/target/release/plugin.exe - retention-days: 10 + args: --manifest-path solo-mode/Cargo.toml --release - name: Temporary store install-sd-solo-enabler.exe uses: actions/upload-artifact@v3 @@ -51,30 +39,3 @@ jobs: name: service path: ./solo-mode-service/target/release/sd-solo-enabler.exe retention-days: 10 - - build-mac-plugin: - runs-on: macos-latest - defaults: - run: - working-directory: ./rust/ - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - - - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --manifest-path rust/Cargo.toml --release - - - name: chmod +x - run: chmod +x ./target/release/plugin - - - name: Temporary store plugin - uses: actions/upload-artifact@v3 - with: - name: com.dim.streamdeck - path: ./rust/target/release/plugin - retention-days: 10 - diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml deleted file mode 100644 index 49891ce..0000000 --- a/.github/workflows/pr-build.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: pr-build -on: - pull_request: - -jobs: - build-property-inspector: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - uses: pnpm/action-setup@v2 - name: Install pnpm - id: pnpm-install - with: - version: 7 - run_install: false - - - name: Build property inspector - working-directory: ./property-inspector/ - run: pnpm install && pnpm build - - build-win-plugin: - runs-on: windows-latest - defaults: - run: - working-directory: ./rust/ - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - - - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --manifest-path rust/Cargo.toml --release - - - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --manifest-path solo-mode-service/Cargo.toml --release - - build-mac-plugin: - runs-on: macos-latest - defaults: - run: - working-directory: ./rust/ - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - - - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --manifest-path rust/Cargo.toml --release - diff --git a/.github/workflows/publish-package.yaml b/.github/workflows/publish-package.yaml index a327ad5..bc0d668 100644 --- a/.github/workflows/publish-package.yaml +++ b/.github/workflows/publish-package.yaml @@ -4,35 +4,25 @@ on: jobs: package-plugin: - runs-on: windows-latest + runs-on: mac-latest steps: - uses: actions/checkout@v3 - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - uses: pnpm/action-setup@v2 name: Install pnpm id: pnpm-install with: - version: 7 - run_install: false + version: 8 + run_install: true - name: Build property inspector working-directory: ./property-inspector/ - run: pnpm install && pnpm build - - - uses: suisei-cn/actions-download-file@v1.3.0 - id: distribution_tool - name: Download Elgato Distribution Tool - with: - url: "https://developer.elgato.com/documentation/stream-deck/distributiontool/DistributionToolWindows.zip" - target: . - - - name: Extract DistributionTool.exe - run: 7z x "${{ steps.distribution_tool.outputs.filename }}" + run: pnpm build - name: Download artifacts uses: dawidd6/action-download-artifact@v2 @@ -40,23 +30,16 @@ jobs: github_token: ${{secrets.SECRET_TOKEN}} workflow: build-plugin.yaml - - name: Extract Version - id: plugin - uses: colathro/crate-version@1.0.0 - with: - file: "./rust/Cargo.toml" - - name: Prepare plugin directory run: | - md plugin/solo-mode - move com.dim.streamdeck.exe/plugin.exe plugin/com.dim.streamdeck.exe - move service-installer/install-sd-solo-enabler.exe plugin/solo-mode/install-sd-solo-enabler.exe - move service-remover/remove-sd-solo-enabler.exe plugin/solo-mode/remove-sd-solo-enabler.exe - move service/sd-solo-enabler.exe plugin/solo-mode/sd-solo-enabler.exe - move com.dim.streamdeck/plugin plugin/com.dim.streamdeck - ren plugin com.dim.streamdeck.sdPlugin - - name: Package plugin - run: ./DistributionTool.exe -b -i com.dim.streamdeck.sdPlugin -o . + mkdir -p plugin/com.dim.streamdeck.sdPlugin/solo-mode + mv service-installer/install-sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/ + mv service-remover/remove-sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/ + mv service/sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/ + + - name: Build plugin + working-directory: ./plugin + run: pnpm build - name: Publish package uses: marvinpinto/action-automatic-releases@latest diff --git a/plugin/package.json b/plugin/package.json index c7621e2..0936ef4 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -6,6 +6,7 @@ }, "devDependencies": { "@elgato/cli": "^0.2.0", + "@fcannizzaro/rollup-stream-deck-package": "^1.0.1", "@rollup/plugin-commonjs": "^25.0.5", "@rollup/plugin-node-resolve": "^15.2.2", "@rollup/plugin-replace": "^5.0.5", diff --git a/plugin/rollup.config.mjs b/plugin/rollup.config.mjs index 0a53fd5..0994457 100644 --- a/plugin/rollup.config.mjs +++ b/plugin/rollup.config.mjs @@ -5,6 +5,7 @@ import url from "node:url"; import copy from "rollup-plugin-copy"; import { swc } from "rollup-plugin-swc3"; import replace from "@rollup/plugin-replace"; +import distributionTool from "@fcannizzaro/rollup-stream-deck-package"; const isWatching = !!process.env.ROLLUP_WATCH; const sdPlugin = "com.dim.streamdeck.sdPlugin"; @@ -29,23 +30,32 @@ const config = { warn(warning); }, plugins: [ - isWatching && + ...(!isWatching && [ + distributionTool({ + plugin: sdPlugin, + }), replace({ "process.env.CHECKPOINT_API": JSON.stringify( process.env.CHECKPOINT_API ), preventAssignment: true, }), + ]), copy({ copyOnce: true, + hook: "buildStart", targets: [ { src: "./node_modules/clipboardy/fallbacks/windows", dest: `${sdPlugin}/fallbacks/`, }, + { + src: "./node_modules/canvaskit-wasm/bin/canvaskit.wasm", + dest: sdPlugin, + }, ], }), - { + isWatching && { name: "watch-externals", buildStart: function () { this.addWatchFile(`${sdPlugin}/manifest.json`); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c0709a..3e02870 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,9 @@ importers: '@elgato/cli': specifier: ^0.2.0 version: 0.2.0 + '@fcannizzaro/rollup-stream-deck-package': + specifier: ^1.0.1 + version: 1.0.1 '@rollup/plugin-commonjs': specifier: ^25.0.5 version: 25.0.7(rollup@4.9.1) @@ -388,6 +391,10 @@ packages: resolution: {integrity: sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==} dev: true + /@fcannizzaro/rollup-stream-deck-package@1.0.1: + resolution: {integrity: sha512-9KTn6X31djt6n0WQb3sohIT2qUZk1vKmxeKV9G99GwALez8ysHNC4EREJZuuGK+Vxh4lwwPP+Qs2FXBGgjtuow==} + dev: true + /@floating-ui/core@1.5.2: resolution: {integrity: sha512-Ii3MrfY/GAIN3OhXNzpCKaLxHQfJF9qvwq/kEJYdqDxeIHa01K8sldugal6TmeeXl+WMvhv9cnVzUTaFFJF09A==} dependencies: