diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 742191f..fc13075 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,44 +13,62 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '20.x' + + - name: Setup PNPM + uses: pnpm/action-setup@v4 + with: + version: 9 + - name: Install Dependencies - run: npm install - - name: build - run: npm run build - - name: copy files into build + run: pnpm install + + - name: Build frontend + run: pnpm run build + + - name: Download Decky Plugin CLI run: | - cp plugin.json ./dist/ - mkdir ./dist/dist - mv ./dist/index.js ./dist/dist/ + mkdir $(pwd)/cli + curl -L -o $(pwd)/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-x86_64" + chmod +x $(pwd)/cli/decky + + - name: Build plugin + run: | + $(pwd)/cli/decky plugin build $(pwd) + unzip "out/Game Theme Music.zip" -d "out/Game Theme Music" + - name: Upload package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: SDH-GameThemeMusic path: | - ./dist/* + ./out/Game Theme Music/* release: needs: build if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 with: name: SDH-GameThemeMusic path: SDH-GameThemeMusic + - name: zip/tar release run: | zip -r SDH-GameThemeMusic.zip SDH-GameThemeMusic/* tar -czvf SDH-GameThemeMusic.tar.gz SDH-GameThemeMusic + - name: Create a release uses: ncipollo/release-action@v1 with: artifacts: 'SDH-GameThemeMusic.zip,SDH-GameThemeMusic.tar.gz' allowUpdates: true - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/plugin.json b/plugin.json index 94a01c4..1c47da7 100644 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "name": "Game Theme Music", "author": "OMGDuke", "flags": [], - "api_version": 2, + "api_version": 1, "publish": { "tags": ["audio"], "description": "Play theme songs on your game pages", diff --git a/src/lib/patchContextMenu.tsx b/src/lib/patchContextMenu.tsx index e2b17c4..7570a06 100644 --- a/src/lib/patchContextMenu.tsx +++ b/src/lib/patchContextMenu.tsx @@ -68,10 +68,15 @@ const contextMenuPatch = (LibraryContextMenu: any) => { component.type.prototype, 'shouldComponentUpdate', ([nextProps]: any, shouldUpdate: any) => { - const gtmIdx = nextProps.children.findIndex( - (x: any) => x?.key === 'game-theme-music-change-music' - ) - if (gtmIdx != -1) nextProps.children.splice(gtmIdx, 1) + try { + const gtmIdx = nextProps.children.findIndex( + (x: any) => x?.key === 'game-theme-music-change-music' + ) + if (gtmIdx != -1) nextProps.children.splice(gtmIdx, 1) + } + catch (e) { + return component; + } if (shouldUpdate === true) { let updatedAppid: number = appid