diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0a48156b6..e1fa7148b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -6,16 +6,16 @@ on: - main jobs: - test: - name: Run all Verifications/Tests + unit_tests: + name: Verify Tests runs-on: self-hosted steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: main - - name: Read Node version + - 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: Use Node.js uses: actions/setup-node@v3 with: @@ -26,21 +26,21 @@ jobs: - name: Install deps run: yarn - name: Prepare - run: yarn nx run-many --target=prepare --parallel --all + 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: Run all unit tests - run: yarn nx run-many --target=test/unit --all --parallel + run: yarn nx run-many --target=test/unit --all --parallel --verbose deploy: name: Deploy Affected Apps runs-on: self-hosted needs: - - test + - unit_tests steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: main diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml new file mode 100644 index 000000000..c54cc16f6 --- /dev/null +++ b/.github/workflows/publish-release.yaml @@ -0,0 +1,56 @@ +name: Release a new version of Playnite-Web + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + pull-requests: write + +jobs: + on_tag_created: + name: On Release Published + needs: [] + + runs-on: self-hosted + + steps: + - name: Checkout + 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: 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 --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 + 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: | + LICENSE + apps/*/.packaged/*.zip diff --git a/.github/workflows/pull-request-master.yaml b/.github/workflows/pull-request-master.yaml index a90e4626c..5e5a1d365 100644 --- a/.github/workflows/pull-request-master.yaml +++ b/.github/workflows/pull-request-master.yaml @@ -6,18 +6,16 @@ on: - main jobs: - run_tests: + unit_tests: name: Verify PR - Tests runs-on: self-hosted steps: - - uses: actions/checkout@v3 + - 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: Save version - run: echo "latest" > version - name: Use Node.js uses: actions/setup-node@v3 with: @@ -40,14 +38,12 @@ jobs: name: Verify PR - Buildable runs-on: self-hosted steps: - - uses: actions/checkout@v3 + - 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: Save version - run: echo "latest" > version - name: Use Node.js uses: actions/setup-node@v3 with: @@ -64,7 +60,7 @@ jobs: ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }} - name: Compile affected apps - run: yarn nx affected --target=compile --parallel --base=HEAD~ --head=HEAD --verbose + run: yarn nx affected --target=build --parallel --base=HEAD~ --head=HEAD --verbose env: ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }} ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }} diff --git a/.gitignore b/.gitignore index 47988ddb0..3835ba736 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ .dist .test-runs +.packaged diff --git a/apps/playnite-web-plugin/package.json b/apps/playnite-web-plugin/package.json index 9f1102e8b..18cb05cca 100644 --- a/apps/playnite-web-plugin/package.json +++ b/apps/playnite-web-plugin/package.json @@ -1,6 +1,6 @@ { "name": "playnite-web-plugin", - "version": "1.0.0", + "version": "0.0.1", "devDependencies": { "nx": "^17.1.2", "rimraf": "^5.0.5" diff --git a/apps/playnite-web-plugin/project.json b/apps/playnite-web-plugin/project.json index c222bcd1c..a1cb44f5d 100644 --- a/apps/playnite-web-plugin/project.json +++ b/apps/playnite-web-plugin/project.json @@ -7,7 +7,7 @@ "executor": "nx:run-commands", "outputs": ["{projectRoot}/.dist"], "options": { - "command": "yarn rimraf .dist", + "command": "yarn rimraf .dist .packaged .test-runs", "cwd": "{projectRoot}" } }, @@ -18,6 +18,13 @@ "cwd": "{projectRoot}/src" } }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "zip -r .packaged/playnite-web-plugin.zip .dist/bin/Release/", + "cwd": "{projectRoot}" + } + }, "test/unit": { "executor": "nx:run-commands", "options": { diff --git a/nx.json b/nx.json index 88e9c2f60..7df970415 100644 --- a/nx.json +++ b/nx.json @@ -4,6 +4,10 @@ "dependsOn": ["^build", "restore"], "cache": true }, + "package": { + "dependsOn": ["build"], + "cache": false + }, "test/unit": { "dependsOn": ["restore", "^restore"], "cache": true diff --git a/package.json b/package.json index 8a20ac091..c497ebf66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "playnite-web", "packageManager": "yarn@4.0.2", + "version": "0.0.1", "private": true, "engines": { "node": ">=20.9.0",