From 28fb0566ea5439579d3c9a222756a72448ae89e0 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 15:29:33 +0000 Subject: [PATCH 01/36] remove packaging of playnite-web plugin Cannot automate packaging and release of Playnite Plugin due to requirement on dotnet version and WPF. --- .github/workflows/ppe.yaml | 78 ++++++++++---------- .github/workflows/publish-release.yaml | 82 +++++++++++----------- .github/workflows/pull-request-master.yaml | 78 ++++++++++---------- 3 files changed, 119 insertions(+), 119 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 7b7b7aaf3..7d934c3e7 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -138,42 +138,42 @@ jobs: - name: Run all unit tests run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows - package_windows: - name: Package for PPE (Windows) - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Install jq - run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]20.9.0" - id: nvm - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" - - name: Enable yarn - run: corepack enable - - run: corepack prepare --activate yarn@^4.0.0 - - name: Install deps - run: yarn - - name: Prepare - run: yarn nx run-many --target=prepare --parallel --all --verbose - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - name: Package apps - run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - NODE_ENV: production - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: packaged-apps - path: apps/*/.packaged + # package_windows: + # name: Package for PPE (Windows) + # runs-on: windows-latest + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 2 + # - name: Install jq + # run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe + # - name: Read .nvmrc + # run: echo "##[set-output name=NODE_VERSION;]20.9.0" + # id: nvm + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + # - name: Enable yarn + # run: corepack enable + # - run: corepack prepare --activate yarn@^4.0.0 + # - name: Install deps + # run: yarn + # - name: Prepare + # run: yarn nx run-many --target=prepare --parallel --all --verbose + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # - name: Package apps + # run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # NODE_ENV: production + # - name: Upload artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: packaged-apps + # path: apps/*/.packaged diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index cdfdcfe44..c5eda3306 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -52,48 +52,48 @@ jobs: LICENSE apps/*/.packaged - release_windows: - name: On Release Published - needs: [] + # release_windows: + # name: On Release Published + # needs: [] - runs-on: windows-latest + # runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Install jq - run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]20.9.0" - id: nvm - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" - - name: Enable yarn - run: corepack enable - - run: corepack prepare --activate yarn@^4.0.0 - - name: Install deps - run: yarn - - name: Prepare - run: yarn nx run-many --target=prepare --parallel --verbose - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 2 + # - name: Install jq + # run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe + # - name: Read .nvmrc + # run: echo "##[set-output name=NODE_VERSION;]20.9.0" + # id: nvm + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + # - name: Enable yarn + # run: corepack enable + # - run: corepack prepare --activate yarn@^4.0.0 + # - name: Install deps + # run: yarn + # - name: Prepare + # run: yarn nx run-many --target=prepare --parallel --verbose + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - name: Package apps - run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - NODE_ENV: production + # - name: Package apps + # run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # NODE_ENV: production - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: | - apps/*/.packaged + # - name: Release + # uses: softprops/action-gh-release@v1 + # with: + # files: | + # apps/*/.packaged diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 8daae24e9..dacb4c625 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -97,43 +97,43 @@ jobs: - name: Run all unit tests run: yarn nx run-many --target=test/unit --parallel --verbose --projects=tag:windows - package_windows: - name: Package (Windows) - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Install jq - run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]20.9.0" - id: nvm - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" - - name: Enable yarn - run: corepack enable - - run: corepack prepare --activate yarn@^4.0.0 - - name: Install deps - run: yarn - - name: Prepare - run: yarn nx run-many --target=prepare --parallel --all --verbose - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # package_windows: + # name: Package (Windows) + # runs-on: windows-latest + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 2 + # - name: Install jq + # run: curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe + # - name: Read .nvmrc + # run: echo "##[set-output name=NODE_VERSION;]20.9.0" + # id: nvm + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + # - name: Enable yarn + # run: corepack enable + # - run: corepack prepare --activate yarn@^4.0.0 + # - name: Install deps + # run: yarn + # - name: Prepare + # run: yarn nx run-many --target=prepare --parallel --all --verbose + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - name: Package apps - run: yarn nx affected --target=package --parallel --base=HEAD~ --head=HEAD --verbose --projects=tag:windows - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - NODE_ENV: production - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: packaged-apps - path: apps/*/.packaged + # - name: Package apps + # run: yarn nx affected --target=package --parallel --base=HEAD~ --head=HEAD --verbose --projects=tag:windows + # env: + # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} + # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} + # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + # NODE_ENV: production + # - name: Upload artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: packaged-apps + # path: apps/*/.packaged From e6ee7961be6dbe254cfed927d345ce15ccc03e91 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 15:50:50 +0000 Subject: [PATCH 02/36] make prettier work --- .vscode/settings.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b513b7b4e..8b568feaf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ }, "dotnet.defaultSolution": "PlayniteWebPlugin.sln", "typescript.tsdk": ".yarn/sdks/typescript/lib", - "typescript.enablePromptUseWorkspaceTsdk": true -} + "typescript.enablePromptUseWorkspaceTsdk": true, + "prettier.prettierPath": ".yarn/unplugged/prettier-npm-3.1.1-072c31ec21/node_modules/prettier" +} \ No newline at end of file From 8557bf857257857911763b1a0fecd3dc376818e9 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 19:49:36 +0000 Subject: [PATCH 03/36] use two spaces --- .prettierrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index a8301fa6e..809782b05 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,6 @@ { "trailingComma": "all", - "tabWidth": 4, + "tabWidth": 2, "semi": false, "singleQuote": true } From 966ab58bc5e0b202b04428a10dafc6e278e42a73 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 19:50:42 +0000 Subject: [PATCH 04/36] no ppe environment --- .github/workflows/ppe.yaml | 49 ++++---------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 7d934c3e7..7e7d69894 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -1,4 +1,4 @@ -name: "PPE" +name: 'PPE' on: push: @@ -19,7 +19,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Install deps run: yarn - name: Prepare @@ -44,7 +44,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Install deps run: yarn - name: Prepare @@ -67,47 +67,6 @@ jobs: name: packaged-apps path: apps/*/.packaged - deploy_ppe: - name: Deploy affected to PPE - runs-on: self-hosted - needs: - - unit_tests_linux - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - ref: main - - name: Read Node version - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" - - uses: actions/setup-dotnet@v2 - with: - dotnet-version: "7.0.403" - - name: Install deps - run: yarn - - name: Prepare - run: yarn nx run-many --target=prepare --parallel --all - env: - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - - name: Deploy affected apps - run: yarn nx affected --target=deploy --parallel --verbose --projects=tag:linux - env: - CODECOV_TOKEN: ${{ secrets.CODE_COV_TOKEN }} - ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} - ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} - ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - MQTT_HOST: ${{ secrets.K8S_MAIN_NODE_IP }} - MQTT_PORT: ${{ secrets.MQTT_PORT_EXTERNAL }} - MQTT_USERNAME: ${{ secrets.MQTT_USERNAME }} - MQTT_PASSWORD: ${{ secrets.MQTT_PASSWORD }} - NODE_ENV: production - unit_tests_windows: name: Verify PR - Tests (Windows) runs-on: windows-latest @@ -123,7 +82,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Enable yarn run: corepack enable - run: corepack prepare --activate yarn@^4.0.0 From c7ae487e69530e5f033599df3017b5ffeb612133 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 19:51:07 +0000 Subject: [PATCH 05/36] syntax only changes --- .github/workflows/publish-release.yaml | 4 ++-- .github/workflows/pull-request-master.yaml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index c5eda3306..a3ad65cf2 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -3,7 +3,7 @@ name: Release a new version of Playnite-Web on: push: tags: - - "v*.*.*" + - 'v*.*.*' permissions: contents: write @@ -27,7 +27,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Install deps run: yarn - name: Prepare diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index dacb4c625..4729fc4cd 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -1,4 +1,4 @@ -name: "Verify Pull Request" +name: 'Verify Pull Request' on: pull_request: @@ -19,7 +19,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Install deps run: yarn - name: Prepare @@ -44,7 +44,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Install deps run: yarn - name: Prepare @@ -82,7 +82,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: "${{ steps.nvm.outputs.NODE_VERSION }}" + node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' - name: Enable yarn run: corepack enable - run: corepack prepare --activate yarn@^4.0.0 From a079330ca325d44a2385586be5693d61285ed09d Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 19:51:38 +0000 Subject: [PATCH 06/36] package as docker image --- .github/workflows/ppe.yaml | 7 ++- apps/game-db-updater/Dockerfile | 6 +++ apps/game-db-updater/project.json | 75 +++++++++++++++++++------------ 3 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 apps/game-db-updater/Dockerfile diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 7e7d69894..c5b636448 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -53,7 +53,12 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux env: diff --git a/apps/game-db-updater/Dockerfile b/apps/game-db-updater/Dockerfile new file mode 100644 index 000000000..017f253db --- /dev/null +++ b/apps/game-db-updater/Dockerfile @@ -0,0 +1,6 @@ +FROM node:20-alpine3.19 + +WORKDIR /opt/playnite-web-game-db-updater +COPY .dist/ . + +ENTRYPOINT [ "node index.js" ] diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index d06b03230..d01535b56 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -1,31 +1,50 @@ { - "name": "game-db-updater", - "sourceRoot": "apps/game-db-updater/src", - "projectType": "application", - "targets": { - "clean": { - "executor": "nx:run-commands", - "options": { - "command": "yarn rimraf .dist .packaged .test-runs", - "cwd": "{projectRoot}" - } - }, - "start": { - "executor": "nx:run-commands", - "options": { - "cwd": "{projectRoot}", - "command": "DEBUG=game-db-updater/* yarn nodemon --inspect src/index.ts" - } - }, - "test": { - "executor": "nx:run-commands", - "outputs": ["{projectRoot}/.test-runs/unit"], - "options": { - "command": "yarn jest --config jest.config.js", - "cwd": "{projectRoot}" - } - } + "name": "game-db-updater", + "sourceRoot": "apps/game-db-updater/src", + "projectType": "application", + "targets": { + "build": { + "executor": "nx:run-commands", + "outputs": ["{projectRoot}/.dist"], + "options": { + "command": ".yarn/unplugged/@esbuild-linux-x64-npm-0.17.19-08a7136aa6/node_modules/@esbuild/linux-x64/bin/esbuild apps/game-db-updater/src/index.ts --bundle --platform=node --target=node20 --outdir=apps/game-db-updater/.dist" + } }, - "tags": ["linux"], - "implicitDependencies": [] + "clean": { + "executor": "nx:run-commands", + "options": { + "command": "yarn rimraf .dist .packaged .test-runs", + "cwd": "{projectRoot}" + } + }, + "package": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$SHA --file Dockerfile .", + "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$SHA", + "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", + "cp -R .dist/ .packaged/" + ], + "cwd": "{projectRoot}" + } + }, + "start": { + "executor": "nx:run-commands", + "options": { + "cwd": "{projectRoot}", + "command": "DEBUG=game-db-updater/* yarn nodemon --inspect src/index.ts" + } + }, + "test": { + "executor": "nx:run-commands", + "outputs": ["{projectRoot}/.test-runs/unit"], + "options": { + "command": "yarn jest --config jest.config.js", + "cwd": "{projectRoot}" + } + } + }, + "tags": ["linux"], + "implicitDependencies": [] } From ab9bc17fe4a9705fdee6d46bd8df1f9dd5f77061 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 19:59:17 +0000 Subject: [PATCH 07/36] only use TAG for docker images --- .github/workflows/ppe.yaml | 1 + .github/workflows/pull-request-master.yaml | 1 + apps/game-db-updater/project.json | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index c5b636448..e122e3263 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -66,6 +66,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} NODE_ENV: production + TAG: nightly - name: Upload artifacts uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 4729fc4cd..7eb090a70 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -60,6 +60,7 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} + TAG: ${{ github.event.pull_request.head.ref }} NODE_ENV: production - name: Upload artifacts uses: actions/upload-artifact@v3 diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index d01535b56..b4a65ee0c 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -21,8 +21,7 @@ "executor": "nx:run-commands", "options": { "commands": [ - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$SHA --file Dockerfile .", - "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$SHA", + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --tag --file Dockerfile .", "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], From 883f4cdd73d81ffe376f2afa5d0311765215b82f Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:03:39 +0000 Subject: [PATCH 08/36] correct test target name --- apps/game-db-updater/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index b4a65ee0c..2155f97ee 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -35,7 +35,7 @@ "command": "DEBUG=game-db-updater/* yarn nodemon --inspect src/index.ts" } }, - "test": { + "test/unit": { "executor": "nx:run-commands", "outputs": ["{projectRoot}/.test-runs/unit"], "options": { From a20b00fbf1296ff1835bfab6c839a80bd584d611 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:07:36 +0000 Subject: [PATCH 09/36] project filters do not work with affected --- .github/workflows/pull-request-master.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 7eb090a70..9417296e3 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -55,7 +55,7 @@ jobs: ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - name: Package apps - run: yarn nx affected --target=package --parallel --base=HEAD~ --head=HEAD --verbose --projects=tag:linux + run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} From daedb489b1fe0e88de397c32c3dc2bf3effed08c Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:17:17 +0000 Subject: [PATCH 10/36] does tag come through? --- apps/game-db-updater/project.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 2155f97ee..e941f57da 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -21,6 +21,7 @@ "executor": "nx:run-commands", "options": { "commands": [ + "echo \"Building for $TAG\"", "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --tag --file Dockerfile .", "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" From 187f3036ff56fbd21e97118c13a81e1a5ba71eb9 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:18:32 +0000 Subject: [PATCH 11/36] correct test setup files pathing --- apps/game-db-updater/jest.config.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/game-db-updater/jest.config.js b/apps/game-db-updater/jest.config.js index b6157798f..e3cc8bf75 100644 --- a/apps/game-db-updater/jest.config.js +++ b/apps/game-db-updater/jest.config.js @@ -1,18 +1,18 @@ const { defaults } = require('jest-config') const defaultConfig = { - transform: { - '^.+\\.(j|t)sx?$': ['ts-jest', {}], - }, - resetMocks: true, - modulePathIgnorePatterns: ['/\\.dist/'], - passWithNoTests: false, - coverageDirectory: '/.test-runs/unit', - collectCoverage: true, - moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], - collectCoverageFrom: ['**/src/**', '**/scripts/**'], - coveragePathIgnorePatterns: ['/__tests__/', '/__mocks__/'], - setupFiles: ['/apps/game-db-updater/.tests/setupFiles.ts'], + transform: { + '^.+\\.(j|t)sx?$': ['ts-jest', {}], + }, + resetMocks: true, + modulePathIgnorePatterns: ['/\\.dist/'], + passWithNoTests: false, + coverageDirectory: '/.test-runs/unit', + collectCoverage: true, + moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], + collectCoverageFrom: ['**/src/**', '**/scripts/**'], + coveragePathIgnorePatterns: ['/__tests__/', '/__mocks__/'], + setupFiles: ['/.tests/setupFiles.ts'], } module.exports = defaultConfig From cdd364c5e7285d53960ea73b5da1e5a4f3f43df3 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:19:54 +0000 Subject: [PATCH 12/36] use sha for artifact version --- .github/workflows/pull-request-master.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 9417296e3..8e636745c 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -60,7 +60,7 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - TAG: ${{ github.event.pull_request.head.ref }} + TAG: ${{ github.event.pull_request.head.sha }} NODE_ENV: production - name: Upload artifacts uses: actions/upload-artifact@v3 From b6f4d454f98e034b7a9c37adf5914f18122182eb Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:23:24 +0000 Subject: [PATCH 13/36] mark tests as e2e tests They requiring an actual MQTT instance --- apps/game-db-updater/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index e941f57da..a201ae313 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -36,7 +36,7 @@ "command": "DEBUG=game-db-updater/* yarn nodemon --inspect src/index.ts" } }, - "test/unit": { + "test/e2e": { "executor": "nx:run-commands", "outputs": ["{projectRoot}/.test-runs/unit"], "options": { From 546cd884b374e03d04a716e3b55de8802b8679c3 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:24:11 +0000 Subject: [PATCH 14/36] correct syntax --- apps/game-db-updater/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index a201ae313..4bce0c691 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,7 +22,7 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --tag --file Dockerfile .", + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], From 61bab8d766033071babf63ec3f78963dbfd35ab5 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:25:33 +0000 Subject: [PATCH 15/36] use dev instead of nightly for tag --- .github/workflows/ppe.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index e122e3263..d91e268c0 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -66,7 +66,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} NODE_ENV: production - TAG: nightly + TAG: dev - name: Upload artifacts uses: actions/upload-artifact@v3 with: From e3ac2134922d57cc2bb235791f10a22fcea5b594 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:32:54 +0000 Subject: [PATCH 16/36] env var coming through --- apps/game-db-updater/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 4bce0c691..9eeae8c1a 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,8 +22,8 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", - "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", + "docker build --tag \"ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG\" --file Dockerfile .", + "docker push \"ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG\"", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From 813335c2b9205bcbefb3b83004fe16c9fef6efa5 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:33:51 +0000 Subject: [PATCH 17/36] must login prior to publishing --- .github/workflows/pull-request-master.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 8e636745c..7454048a4 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -53,7 +53,12 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux env: From 8099ca74737b5d0a7a474ab6161a17636fc78654 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:36:10 +0000 Subject: [PATCH 18/36] use latest version --- .github/workflows/ppe.yaml | 2 +- .github/workflows/pull-request-master.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index d91e268c0..5f5523d6c 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -54,7 +54,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 7454048a4..1bc30bf29 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -54,7 +54,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} From 5909fd29f6914f735a83ae4a4e9b3378b80de2e3 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:38:06 +0000 Subject: [PATCH 19/36] debugging --- apps/game-db-updater/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 9eeae8c1a..22c197d4b 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,8 +22,8 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "docker build --tag \"ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG\" --file Dockerfile .", - "docker push \"ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG\"", + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", + "echo $TAG && docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From ae0425a439a15235600e52fb07fa4e42b16751c5 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:46:05 +0000 Subject: [PATCH 20/36] try to log into registry differently --- apps/game-db-updater/project.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 22c197d4b..10fb47b56 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,8 +22,9 @@ "options": { "commands": [ "echo \"Building for $TAG\"", + "echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin", "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", - "echo $TAG && docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", + "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From dd78fe0c69b07eef23f598a0a91b29b96034b22b Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Dec 2023 20:48:50 +0000 Subject: [PATCH 21/36] debugging --- apps/game-db-updater/project.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 10fb47b56..d6ca0894e 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,9 +22,8 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin", - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", - "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:latest --file Dockerfile .", + "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:latest", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From f119a0e6087868ff6251158470702fe634510fa2 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 13:55:39 +0000 Subject: [PATCH 22/36] convert back to tag --- apps/game-db-updater/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index d6ca0894e..4bce0c691 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,8 +22,8 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:latest --file Dockerfile .", - "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:latest", + "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", + "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From 90297266bb1af2fddf38e5b2d5b50b9724ab5a05 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 13:57:59 +0000 Subject: [PATCH 23/36] assign permissions to workflows/jobs --- .github/workflows/ppe.yaml | 4 ++++ .github/workflows/publish-release.yaml | 1 + .github/workflows/pull-request-master.yaml | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 5f5523d6c..55877dfe4 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -5,6 +5,10 @@ on: branches: - main +permissions: + contents: read + packages: write + jobs: unit_tests_linux: name: Verify Tests (Linux) diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index a3ad65cf2..cef0ca0c2 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -8,6 +8,7 @@ on: permissions: contents: write pull-requests: write + packages: write jobs: release_linux: diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 1bc30bf29..dc6491a43 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -5,6 +5,11 @@ on: branches: - main +permissions: + contents: read + pull-requests: write + packages: write + jobs: unit_tests_linux: name: Verify PR - Tests (Linxu) From 0d0e7039d55922a8a63767f324cfceedfa662ab1 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:05:38 +0000 Subject: [PATCH 24/36] try manual login to registry --- .github/workflows/pull-request-master.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index dc6491a43..86f2e725c 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -8,7 +8,6 @@ on: permissions: contents: read pull-requests: write - packages: write jobs: unit_tests_linux: @@ -39,6 +38,8 @@ jobs: package_linux: name: Package (Linux) runs-on: self-hosted + permissions: + packages: write steps: - uses: actions/checkout@v4 with: @@ -58,12 +59,8 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - name: Package apps run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux env: From cae559850374d9fb320ce96e2127c99bbb553bb5 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:31:26 +0000 Subject: [PATCH 25/36] testing --- .github/workflows/ppe.yaml | 11 +++++++---- .github/workflows/publish-release.yaml | 16 ++++++++++++---- .github/workflows/pull-request-master.yaml | 22 ++++++++++++++++++---- apps/PlayniteWebPlugin/project.json | 2 +- apps/game-db-updater/project.json | 3 +-- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 55877dfe4..6e023bfcf 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -7,7 +7,6 @@ on: permissions: contents: read - packages: write jobs: unit_tests_linux: @@ -38,6 +37,10 @@ jobs: package_for_ppe_linux: name: Package for PPE (Linux) runs-on: self-hosted + permissions: + packages: write + env: + REGISTRY: ghcr.io steps: - uses: actions/checkout@v4 with: @@ -60,11 +63,11 @@ jobs: - name: Log in to the Container registry uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY}} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps - run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux + run: yarn nx affected --target=package/linux --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} @@ -135,7 +138,7 @@ jobs: # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows + # run: yarn nx affected --target=package/windows --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index cef0ca0c2..e5ca1719d 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -14,7 +14,10 @@ jobs: release_linux: name: On Release Published needs: [] - + permissions: + packages: write + env: + REGISTRY: ghcr.io runs-on: self-hosted steps: @@ -37,9 +40,14 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps - run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux + run: yarn nx run-many --target=package/linux --parallel --verbose --all env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} @@ -86,7 +94,7 @@ jobs: # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx run-many --target=package --parallel --verbose --projects=tag:windows + # run: yarn nx run-many --target=package/windows --parallel --verbose --all # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 86f2e725c..8b5452058 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -40,6 +40,8 @@ jobs: runs-on: self-hosted permissions: packages: write + env: + REGISTRY: ghcr.io steps: - uses: actions/checkout@v4 with: @@ -59,16 +61,28 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - - name: Log in to registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps - run: yarn nx run-many --target=package --parallel --verbose --projects=tag:linux + run: yarn nx affected --target=package/linux --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} TAG: ${{ github.event.pull_request.head.sha }} NODE_ENV: production + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: apps/game-db-updater + push: true + tags: dev + - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -134,7 +148,7 @@ jobs: # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx affected --target=package --parallel --base=HEAD~ --head=HEAD --verbose --projects=tag:windows + # run: yarn nx affected --target=package/windows --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/apps/PlayniteWebPlugin/project.json b/apps/PlayniteWebPlugin/project.json index a1e6cdd36..403ba37ad 100644 --- a/apps/PlayniteWebPlugin/project.json +++ b/apps/PlayniteWebPlugin/project.json @@ -25,7 +25,7 @@ "cwd": "{projectRoot}/src" } }, - "package": { + "package/windows": { "executor": "nx:run-commands", "options": { "commands": [ diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index 4bce0c691..d3ea84deb 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -17,13 +17,12 @@ "cwd": "{projectRoot}" } }, - "package": { + "package/linux": { "executor": "nx:run-commands", "options": { "commands": [ "echo \"Building for $TAG\"", "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", - "docker push ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From 22de843426e8240e995664ddc00fc3e611560220 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:35:51 +0000 Subject: [PATCH 26/36] nx target default updates --- nx.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nx.json b/nx.json index a17f943ac..4626829ab 100644 --- a/nx.json +++ b/nx.json @@ -4,7 +4,11 @@ "dependsOn": ["^build", "build/restore"], "cache": true }, - "package": { + "package/linux": { + "dependsOn": ["build"], + "cache": false + }, + "package/windows": { "dependsOn": ["build"], "cache": false }, From 8b08435f395f0ce1b45e7964562d6e64b3a6a159 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:39:00 +0000 Subject: [PATCH 27/36] try buildx setup --- .github/workflows/pull-request-master.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 8b5452058..d4d0f9a18 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -67,6 +67,8 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Package apps run: yarn nx affected --target=package/linux --parallel --base=HEAD~ --head=HEAD --verbose env: From 91673790456706cd014d097e6716cd5597ae7539 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:40:34 +0000 Subject: [PATCH 28/36] pr-number is tag --- .github/workflows/pull-request-master.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index d4d0f9a18..52dcf0e1a 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -83,7 +83,7 @@ jobs: with: context: apps/game-db-updater push: true - tags: dev + tags: pr-${{ github.event.pull_request.number }} - name: Upload artifacts uses: actions/upload-artifact@v3 From 14e08169d58a8063c8c28032ae924bc8f8ae05a6 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:54:23 +0000 Subject: [PATCH 29/36] perm and use full repo name --- .github/workflows/pull-request-master.yaml | 40 ++++++++++++++++------ apps/game-db-updater/project.json | 2 +- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 52dcf0e1a..39c96a2f8 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -12,18 +12,27 @@ permissions: jobs: unit_tests_linux: name: Verify PR - Tests (Linxu) - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - id: nvm + - name: Extract node version from package.json + uses: sergeysova/jq-action@v2 + id: node_version + with: + cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g' + - name: Extract yarn version from package.json + uses: sergeysova/jq-action@v2 + id: yarn_version + with: + cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' + node-version: '${{ steps.node_version.outputs.value }}' + - name: Use Yarn + run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }} - name: Install deps run: yarn - name: Prepare @@ -37,7 +46,7 @@ jobs: package_linux: name: Package (Linux) - runs-on: self-hosted + runs-on: ubuntu-latest permissions: packages: write env: @@ -46,13 +55,22 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 2 - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - id: nvm + - name: Extract node version from package.json + uses: sergeysova/jq-action@v2 + id: node_version + with: + cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g' + - name: Extract yarn version from package.json + uses: sergeysova/jq-action@v2 + id: yarn_version + with: + cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' + node-version: '${{ steps.node_version.outputs.value }}' + - name: Use Yarn + run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }} - name: Install deps run: yarn - name: Prepare @@ -75,7 +93,7 @@ jobs: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - TAG: ${{ github.event.pull_request.head.sha }} + TAG: ${{ env.REGISTRY }}/${{ github.repository }}:game-db-updater-PR${{ github.event.pull_request.number }} NODE_ENV: production - name: Build and push Docker image diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index d3ea84deb..b831d1078 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -22,7 +22,7 @@ "options": { "commands": [ "echo \"Building for $TAG\"", - "docker build --tag ghcr.io/andrew-codes/playnite-web-game-db-updater:$TAG --file Dockerfile .", + "docker build --tag $TAG --file Dockerfile .", "cp -R .dist/ .packaged/" ], "cwd": "{projectRoot}" From acea86f07fad7eb3c217381e0acaff08a611a364 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:57:46 +0000 Subject: [PATCH 30/36] use latest minor of yarn 4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b17ae6ba4..4759999e4 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "engines": { "node": ">=20.9.0", - "yarn": ">=4.0.0" + "yarn": "^4.0.0" }, "workspaces": [ "apps/*", From 55548b78862ab5a728ae7f365a71248708f1722c Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 14:58:03 +0000 Subject: [PATCH 31/36] follow same pattern to avoid self-hosted --- .github/workflows/ppe.yaml | 38 +++++++++++++++++++------- .github/workflows/publish-release.yaml | 22 ++++++++++----- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 6e023bfcf..07c3a0897 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -11,18 +11,27 @@ permissions: jobs: unit_tests_linux: name: Verify Tests (Linux) - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - id: nvm + - name: Extract node version from package.json + uses: sergeysova/jq-action@v2 + id: node_version + with: + cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g' + - name: Extract yarn version from package.json + uses: sergeysova/jq-action@v2 + id: yarn_version + with: + cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' + node-version: '${{ steps.node_version.outputs.value }}' + - name: Use Yarn + run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }} - name: Install deps run: yarn - name: Prepare @@ -36,7 +45,7 @@ jobs: package_for_ppe_linux: name: Package for PPE (Linux) - runs-on: self-hosted + runs-on: ubuntu-latest permissions: packages: write env: @@ -45,13 +54,22 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 2 - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - id: nvm + - name: Extract node version from package.json + uses: sergeysova/jq-action@v2 + id: node_version + with: + cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g' + - name: Extract yarn version from package.json + uses: sergeysova/jq-action@v2 + id: yarn_version + with: + cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' + node-version: '${{ steps.node_version.outputs.value }}' + - name: Use Yarn + run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }} - name: Install deps run: yarn - name: Prepare diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index e5ca1719d..c1cb0a404 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -7,8 +7,6 @@ on: permissions: contents: write - pull-requests: write - packages: write jobs: release_linux: @@ -18,20 +16,30 @@ jobs: packages: write env: REGISTRY: ghcr.io - runs-on: self-hosted + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 2 - - name: Read .nvmrc - run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')" - id: nvm + - name: Extract node version from package.json + uses: sergeysova/jq-action@v2 + id: node_version + with: + cmd: jq .engines.node package.json -r | sed -e 's/"//g' | sed -e 's/>=//g' + - name: Extract yarn version from package.json + uses: sergeysova/jq-action@v2 + id: yarn_version + with: + cmd: jq .engines.yarn package.json -r | sed -e 's/"//g' - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '${{ steps.nvm.outputs.NODE_VERSION }}' + node-version: '${{ steps.node_version.outputs.value }}' + - name: Use Yarn + run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }} + - name: Install deps run: yarn - name: Prepare From c1636e7d227d6ac56e23e59a7be01aaf132f1aa0 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 15:11:58 +0000 Subject: [PATCH 32/36] updates --- .github/workflows/ppe.yaml | 4 ++-- .github/workflows/publish-release.yaml | 4 ++-- .github/workflows/pull-request-master.yaml | 12 ++---------- .../node-gyp/macOS_Catalina_acid_test.sh | 0 apps/PlayniteWebPlugin/project.json | 8 +++----- apps/PlayniteWebPlugin/scripts/package.sh | 7 +++++++ apps/game-db-updater/project.json | 7 +++++++ apps/game-db-updater/scripts/package.sh | 8 ++++++++ apps/game-db-updater/scripts/publish.sh | 7 +++++++ nx.json | 6 +----- 10 files changed, 39 insertions(+), 24 deletions(-) mode change 100644 => 100755 .yarn/unplugged/node-gyp-npm-10.0.1-48708ce70b/node_modules/node-gyp/macOS_Catalina_acid_test.sh create mode 100755 apps/PlayniteWebPlugin/scripts/package.sh create mode 100755 apps/game-db-updater/scripts/package.sh create mode 100755 apps/game-db-updater/scripts/publish.sh diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 07c3a0897..a2e2f5d21 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -85,7 +85,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps - run: yarn nx affected --target=package/linux --parallel --base=HEAD~ --head=HEAD --verbose + run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} @@ -156,7 +156,7 @@ jobs: # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx affected --target=package/windows --parallel --base=HEAD~ --head=HEAD --verbose + # run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index c1cb0a404..a9d004237 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -55,7 +55,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Package apps - run: yarn nx run-many --target=package/linux --parallel --verbose --all + run: yarn nx run-many --target=publish --parallel --verbose --all env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} @@ -102,7 +102,7 @@ jobs: # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx run-many --target=package/windows --parallel --verbose --all + # run: yarn nx run-many --target=publish --parallel --verbose --all # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 39c96a2f8..4ab5995e7 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -88,21 +88,13 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Package apps - run: yarn nx affected --target=package/linux --parallel --base=HEAD~ --head=HEAD --verbose + run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} TAG: ${{ env.REGISTRY }}/${{ github.repository }}:game-db-updater-PR${{ github.event.pull_request.number }} NODE_ENV: production - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: apps/game-db-updater - push: true - tags: pr-${{ github.event.pull_request.number }} - - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -168,7 +160,7 @@ jobs: # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} # - name: Package apps - # run: yarn nx affected --target=package/windows --parallel --base=HEAD~ --head=HEAD --verbose + # run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.yarn/unplugged/node-gyp-npm-10.0.1-48708ce70b/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/.yarn/unplugged/node-gyp-npm-10.0.1-48708ce70b/node_modules/node-gyp/macOS_Catalina_acid_test.sh old mode 100644 new mode 100755 diff --git a/apps/PlayniteWebPlugin/project.json b/apps/PlayniteWebPlugin/project.json index 403ba37ad..7c73d89b7 100644 --- a/apps/PlayniteWebPlugin/project.json +++ b/apps/PlayniteWebPlugin/project.json @@ -25,13 +25,11 @@ "cwd": "{projectRoot}/src" } }, - "package/windows": { + "package": { "executor": "nx:run-commands", "options": { - "commands": [ - "Toolbox.exe pack ../../../../../apps/playnite-web-extension/.dist/bin/Release/ ../../../../../apps/playnite-web-extension/.packaged" - ], - "cwd": "libs/build-utils/playnite-toolbox/src/Toolbox" + "commands": "./scripts/package.sh", + "cwd": "{projectRoot}" } }, "test/unit/restore": { diff --git a/apps/PlayniteWebPlugin/scripts/package.sh b/apps/PlayniteWebPlugin/scripts/package.sh new file mode 100755 index 000000000..44559e821 --- /dev/null +++ b/apps/PlayniteWebPlugin/scripts/package.sh @@ -0,0 +1,7 @@ +OS=$(uname) + +if [ ! "$OS" = "WindowsNT" ]; then + exit 0 +fi + +../../../../../libs/build-utils/playnite-toolbox/src/Toolbox/Toolbox.exe pack apps/playnite-web-extension/.dist/bin/Release/ apps/playnite-web-extension/.packaged diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index b831d1078..a6739240a 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -28,6 +28,13 @@ "cwd": "{projectRoot}" } }, + "publish": { + "executor": "nx:run-commands", + "options": { + "commands": ["docker push $TAG"], + "cwd": "{projectRoot}" + } + }, "start": { "executor": "nx:run-commands", "options": { diff --git a/apps/game-db-updater/scripts/package.sh b/apps/game-db-updater/scripts/package.sh new file mode 100755 index 000000000..f3c588d88 --- /dev/null +++ b/apps/game-db-updater/scripts/package.sh @@ -0,0 +1,8 @@ +OS=$(uname) + +if [ ! "$OS" = "Linux" ]; then + exit 0 +fi + +docker build --tag "$TAG" --file Dockerfile . +cp -R .dist/ .packaged/ diff --git a/apps/game-db-updater/scripts/publish.sh b/apps/game-db-updater/scripts/publish.sh new file mode 100755 index 000000000..bc2d0525e --- /dev/null +++ b/apps/game-db-updater/scripts/publish.sh @@ -0,0 +1,7 @@ +OS=$(uname) + +if [ ! "$OS" = "Linux" ]; then + exit 0 +fi + +docker push "$TAG" diff --git a/nx.json b/nx.json index 4626829ab..a17f943ac 100644 --- a/nx.json +++ b/nx.json @@ -4,11 +4,7 @@ "dependsOn": ["^build", "build/restore"], "cache": true }, - "package/linux": { - "dependsOn": ["build"], - "cache": false - }, - "package/windows": { + "package": { "dependsOn": ["build"], "cache": false }, From 2d040d0361ce200bdf755e86ab2798d8b86b7c2a Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 15:14:07 +0000 Subject: [PATCH 33/36] syntax update --- apps/game-db-updater/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/game-db-updater/project.json b/apps/game-db-updater/project.json index a6739240a..053385cdf 100644 --- a/apps/game-db-updater/project.json +++ b/apps/game-db-updater/project.json @@ -17,7 +17,7 @@ "cwd": "{projectRoot}" } }, - "package/linux": { + "package": { "executor": "nx:run-commands", "options": { "commands": [ From 832929b408bec4dc063d2e8267d76bff49c18541 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 15:15:58 +0000 Subject: [PATCH 34/36] rename to publish apps --- .github/workflows/ppe.yaml | 4 ++-- .github/workflows/publish-release.yaml | 4 ++-- .github/workflows/pull-request-master.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index a2e2f5d21..607986236 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -84,7 +84,7 @@ jobs: registry: ${{ env.REGISTRY}} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Package apps + - name: Publish apps run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} @@ -155,7 +155,7 @@ jobs: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - # - name: Package apps + # - name: Publish apps # run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index a9d004237..87d814f8b 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -54,7 +54,7 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Package apps + - name: Publish apps run: yarn nx run-many --target=publish --parallel --verbose --all env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} @@ -101,7 +101,7 @@ jobs: # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - # - name: Package apps + # - name: Publish apps # run: yarn nx run-many --target=publish --parallel --verbose --all # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index 4ab5995e7..a1f66fefb 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -87,7 +87,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Package apps + - name: Publish apps run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} @@ -159,7 +159,7 @@ jobs: # ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} # ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - # - name: Package apps + # - name: Publish apps # run: yarn nx affected --target=publish --parallel --base=HEAD~ --head=HEAD --verbose # env: # ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} From bc281f8ea33554f8717a64c43ef316f0b0ae83b0 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 15:34:12 +0000 Subject: [PATCH 35/36] clean up merged PRs by removing their packages --- .../workflows/pull-request-master-closed.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/pull-request-master-closed.yaml diff --git a/.github/workflows/pull-request-master-closed.yaml b/.github/workflows/pull-request-master-closed.yaml new file mode 100644 index 000000000..21da8975d --- /dev/null +++ b/.github/workflows/pull-request-master-closed.yaml @@ -0,0 +1,25 @@ +name: 'Remove Pull Request Packages' + +on: + pull_request: + types: [closed] + +permissions: + packages: write + +env: + REGISTRY: ghcr.io + +jobs: + retention_policy: + if: github.event.pull_request.merged == true + name: Retention policy + runs-on: ubuntu-latest + steps: + - uses: actions/delete-package-versions@v4 + with: + owner: ${{ github.actor }} + token: ${{ secrets.GITHUB_TOKEN }} + package-type: container + package-name: ${{ env.REGISTRY }}/${{ github.repository }} + ignore-versions: '^([a-z0-9]+-v[0-9]+\.[0-9]+\.[0-9]+)|([a-z0-9]+-PR(?!${{ github.event.pull_request.number }}))$]' From 3b89f38993bda9f7b26c7627ec5f627aa8d93077 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 28 Dec 2023 15:37:13 +0000 Subject: [PATCH 36/36] ignore dev (latest) versions --- .github/workflows/ppe.yaml | 4 ++-- .github/workflows/pull-request-master-closed.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ppe.yaml b/.github/workflows/ppe.yaml index 607986236..7bc85293d 100644 --- a/.github/workflows/ppe.yaml +++ b/.github/workflows/ppe.yaml @@ -1,4 +1,4 @@ -name: 'PPE' +name: 'Publish dev artifacts (latest dev)' on: push: @@ -91,7 +91,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} NODE_ENV: production - TAG: dev + TAG: ${{ env.REGISTRY }}/${{ github.repository }}:game-db-updater-dev - name: Upload artifacts uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/pull-request-master-closed.yaml b/.github/workflows/pull-request-master-closed.yaml index 21da8975d..7f30a9fda 100644 --- a/.github/workflows/pull-request-master-closed.yaml +++ b/.github/workflows/pull-request-master-closed.yaml @@ -22,4 +22,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} package-type: container package-name: ${{ env.REGISTRY }}/${{ github.repository }} - ignore-versions: '^([a-z0-9]+-v[0-9]+\.[0-9]+\.[0-9]+)|([a-z0-9]+-PR(?!${{ github.event.pull_request.number }}))$]' + ignore-versions: '^([a-z0-9]+-v[0-9]+\.[0-9]+\.[0-9]+)|([a-z0-9]+-PR(?!${{ github.event.pull_request.number }})|([a-z0-9]+-dev))$]'