From 9577b25547b2be44232c6954e316024de7260963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:18:14 +0000 Subject: [PATCH 1/7] feat: implement version unifier --- .github/workflows/publish.yml | 5 ++++- core/deno.json | 1 - deno.json | 6 +----- docs/deno.json | 4 +--- quickjs/deno.json | 1 - set-version.ts | 14 ++++++++++++++ 6 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 set-version.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e4e5c64..2772973 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,8 +23,11 @@ jobs: with: deno-version: v2.x + - name: Install Dependencies + run: deno install --allow-scripts + - name: Run tests - run: deno task test + run: deno task --recursive test - name: Get version from deno.json id: get_version diff --git a/core/deno.json b/core/deno.json index 237ea8e..03ca3e4 100644 --- a/core/deno.json +++ b/core/deno.json @@ -7,6 +7,5 @@ "test": "deno task check-circular-dependencies & deno task check-deploy" }, "name": "@dalbit-yaksok/core", - "version": "0.2.0-alpha.9+20241212.nightly", "exports": "./mod.ts" } \ No newline at end of file diff --git a/deno.json b/deno.json index 5ac73c7..061ba30 100644 --- a/deno.json +++ b/deno.json @@ -21,9 +21,5 @@ "core", "test" ], - "publish": { - "include": [ - "./src" - ] - } + "version": "0.2.0-alpha.9+20241212.nightly" } \ No newline at end of file diff --git a/docs/deno.json b/docs/deno.json index 118b644..96c8670 100644 --- a/docs/deno.json +++ b/docs/deno.json @@ -1,5 +1,4 @@ { - "name": "@dalbit-yaksok/docs", "imports": { "@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.2", "@vue/runtime-dom": "npm:@vue/runtime-dom@^3.5.12", @@ -21,6 +20,5 @@ "dev": "deno task typedoc --watch & deno task vitepress-dev", "build": "deno task purge; deno task typedoc && deno task vitepress-build", "test": "deno task build; deno task purge" - }, - "exports": "./docs/.vitepress/dist" + } } \ No newline at end of file diff --git a/quickjs/deno.json b/quickjs/deno.json index 981b428..593cf5f 100644 --- a/quickjs/deno.json +++ b/quickjs/deno.json @@ -5,7 +5,6 @@ "quickjs-emscripten": "npm:quickjs-emscripten@^0.31.0", "quickjs-emscripten-core": "npm:quickjs-emscripten-core@^0.31.0" }, - "version": "0.2.0-alpha.9+20241212.nightly", "tasks": { "check-deploy": "deno publish --dry-run --allow-dirty", "test": "deno test --quiet --allow-net --allow-read --parallel & deno lint & deno task check-deploy" diff --git a/set-version.ts b/set-version.ts new file mode 100644 index 0000000..8abdf97 --- /dev/null +++ b/set-version.ts @@ -0,0 +1,14 @@ +const rootModule = JSON.parse(await Deno.readTextFile('./deno.json')) +const subModules = rootModule.workspace + +for (const subModule of subModules) { + const subModulePath = `./${subModule}/deno.json` + const subModuleJson = JSON.parse(await Deno.readTextFile(subModulePath)) + + subModuleJson.version = rootModule.version + + await Deno.writeTextFile( + subModulePath, + JSON.stringify(subModuleJson, null, 2), + ) +} From ca3f6bb70bf176e7ac8283d6a32ee95806236571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:20:01 +0000 Subject: [PATCH 2/7] fix: pass non-publishing module --- set-version.ts => apply-version.ts | 4 ++++ 1 file changed, 4 insertions(+) rename set-version.ts => apply-version.ts (88%) diff --git a/set-version.ts b/apply-version.ts similarity index 88% rename from set-version.ts rename to apply-version.ts index 8abdf97..4f272fa 100644 --- a/set-version.ts +++ b/apply-version.ts @@ -5,6 +5,10 @@ for (const subModule of subModules) { const subModulePath = `./${subModule}/deno.json` const subModuleJson = JSON.parse(await Deno.readTextFile(subModulePath)) + if (!subModuleJson.name) { + continue + } + subModuleJson.version = rootModule.version await Deno.writeTextFile( From fb9911b46e82716eb6645505e2864e911b692ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:23:27 +0000 Subject: [PATCH 3/7] chore: remove main branch test action --- .github/workflows/publish-quickjs.yml | 38 --------------------------- .github/workflows/test.yml | 2 -- deno.json | 5 +++- 3 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/publish-quickjs.yml diff --git a/.github/workflows/publish-quickjs.yml b/.github/workflows/publish-quickjs.yml deleted file mode 100644 index 0ee95a9..0000000 --- a/.github/workflows/publish-quickjs.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish - QuickJS -on: - push: - branches: - - main - paths: - - 'quickjs/deno.json' - -jobs: - Publish: - runs-on: ubuntu-latest - env: - working-directory: ./quickjs - - permissions: - contents: write - id-token: write - - steps: - - name: Setup repo - uses: actions/checkout@v4 - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Run linter - run: deno lint - working-directory: ${{ env.working-directory }} - - - name: Run tests - run: deno test --allow-read --allow-net - working-directory: ${{ env.working-directory }} - - - name: Publish to JSR - run: deno publish - working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ede0ee..8ccd66d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,6 @@ name: Test on: - push: - branches: ['main'] pull_request: branches: ['main'] diff --git a/deno.json b/deno.json index 061ba30..bc06154 100644 --- a/deno.json +++ b/deno.json @@ -21,5 +21,8 @@ "core", "test" ], - "version": "0.2.0-alpha.9+20241212.nightly" + "version": "0.2.0-alpha.9+20241212.nightly", + "tasks": { + "publish": "deno run --allow-read --allow-write apply-version.ts && deno task --recursive test && deno publish --allow-dirty" + } } \ No newline at end of file From 8a1cb80fc25b0888bf128a5e512ac5395274c5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:25:11 +0000 Subject: [PATCH 4/7] chore: bump package version to 0.2.0-alpha.10+20241217.nightly --- deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno.json b/deno.json index bc06154..b5af7a0 100644 --- a/deno.json +++ b/deno.json @@ -21,7 +21,7 @@ "core", "test" ], - "version": "0.2.0-alpha.9+20241212.nightly", + "version": "0.2.0-alpha.10+20241217.nightly", "tasks": { "publish": "deno run --allow-read --allow-write apply-version.ts && deno task --recursive test && deno publish --allow-dirty" } From a117c10309516d27b405a41a5273afc0e4b66203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:28:37 +0000 Subject: [PATCH 5/7] fix: apply workspace version before test --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- deno.json | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2772973..3283a22 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,7 +27,7 @@ jobs: run: deno install --allow-scripts - name: Run tests - run: deno task --recursive test + run: deno task test - name: Get version from deno.json id: get_version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ccd66d..ecb4cd1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,4 +24,4 @@ jobs: run: deno install --allow-scripts - name: Run tests - run: deno task --recursive test + run: deno task test diff --git a/deno.json b/deno.json index b5af7a0..7db2f7e 100644 --- a/deno.json +++ b/deno.json @@ -23,6 +23,8 @@ ], "version": "0.2.0-alpha.10+20241217.nightly", "tasks": { - "publish": "deno run --allow-read --allow-write apply-version.ts && deno task --recursive test && deno publish --allow-dirty" + "apply-version": "deno run --allow-read --allow-write apply-version.ts", + "publish": "deno task apply-version && deno task --recursive test && deno publish --allow-dirty", + "test": "deno task apply-version && deno task --recursive test" } } \ No newline at end of file From 02d34463335195efdd7e21e5c1d19ce8f9320d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:36:22 +0000 Subject: [PATCH 6/7] chore: run workspace version applier in actions --- .github/workflows/publish.yml | 3 +++ .github/workflows/test.yml | 3 +++ core/deno.json | 19 ++++++++++--------- deno.json | 3 +-- quickjs/deno.json | 21 +++++++++++---------- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3283a22..aec4e84 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,9 @@ jobs: with: deno-version: v2.x + - name: Apply Workspace Version + run: deno task apply-version + - name: Install Dependencies run: deno install --allow-scripts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ecb4cd1..bd449da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,9 @@ jobs: with: deno-version: v2.x + - name: Apply Workspace Version + run: deno task apply-version + - name: Install Dependencies run: deno install --allow-scripts diff --git a/core/deno.json b/core/deno.json index 03ca3e4..f8a4cdf 100644 --- a/core/deno.json +++ b/core/deno.json @@ -1,11 +1,12 @@ { - "tasks": { - "coverage": "rm -rf ./cov && deno test --quiet --allow-net --allow-read --parallel --coverage=cov && deno coverage --detailed ./cov && rm -rf ./cov", - "coverage-list": "rm -rf ./cov && deno test --quiet --allow-net --allow-read --parallel --coverage=cov && deno coverage ./cov && rm -rf ./cov", - "check-circular-dependencies": "deno run -A npm:madge --circular --extensions ts ./", - "check-deploy": "deno publish --dry-run --allow-dirty", - "test": "deno task check-circular-dependencies & deno task check-deploy" - }, - "name": "@dalbit-yaksok/core", - "exports": "./mod.ts" + "tasks": { + "coverage": "rm -rf ./cov && deno test --quiet --allow-net --allow-read --parallel --coverage=cov && deno coverage --detailed ./cov && rm -rf ./cov", + "coverage-list": "rm -rf ./cov && deno test --quiet --allow-net --allow-read --parallel --coverage=cov && deno coverage ./cov && rm -rf ./cov", + "check-circular-dependencies": "deno run -A npm:madge --circular --extensions ts ./", + "check-deploy": "deno publish --dry-run --allow-dirty", + "test": "deno task check-circular-dependencies & deno task check-deploy" + }, + "name": "@dalbit-yaksok/core", + "exports": "./mod.ts", + "version": "0.2.0-alpha.10+20241217.nightly" } \ No newline at end of file diff --git a/deno.json b/deno.json index 7db2f7e..5db88bc 100644 --- a/deno.json +++ b/deno.json @@ -24,7 +24,6 @@ "version": "0.2.0-alpha.10+20241217.nightly", "tasks": { "apply-version": "deno run --allow-read --allow-write apply-version.ts", - "publish": "deno task apply-version && deno task --recursive test && deno publish --allow-dirty", - "test": "deno task apply-version && deno task --recursive test" + "publish": "deno task --recursive test && deno publish --allow-dirty" } } \ No newline at end of file diff --git a/quickjs/deno.json b/quickjs/deno.json index 593cf5f..006f532 100644 --- a/quickjs/deno.json +++ b/quickjs/deno.json @@ -1,12 +1,13 @@ { - "name": "@dalbit-yaksok/quickjs", - "exports": "./mod.ts", - "imports": { - "quickjs-emscripten": "npm:quickjs-emscripten@^0.31.0", - "quickjs-emscripten-core": "npm:quickjs-emscripten-core@^0.31.0" - }, - "tasks": { - "check-deploy": "deno publish --dry-run --allow-dirty", - "test": "deno test --quiet --allow-net --allow-read --parallel & deno lint & deno task check-deploy" - } + "name": "@dalbit-yaksok/quickjs", + "exports": "./mod.ts", + "imports": { + "quickjs-emscripten": "npm:quickjs-emscripten@^0.31.0", + "quickjs-emscripten-core": "npm:quickjs-emscripten-core@^0.31.0" + }, + "tasks": { + "check-deploy": "deno publish --dry-run --allow-dirty", + "test": "deno test --quiet --allow-net --allow-read --parallel & deno lint & deno task check-deploy" + }, + "version": "0.2.0-alpha.10+20241217.nightly" } \ No newline at end of file From a4a2c5c81bb17a9a423839bcbf3449c1db585171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=9C=20Rycont?= <35295182+rycont@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:37:52 +0000 Subject: [PATCH 7/7] chore: create github tag after successful deployment --- .github/workflows/publish.yml | 8 ++------ .github/workflows/test.yml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aec4e84..789d7b0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,8 +29,8 @@ jobs: - name: Install Dependencies run: deno install --allow-scripts - - name: Run tests - run: deno task test + - name: Publish to JSR + run: deno publish - name: Get version from deno.json id: get_version @@ -42,7 +42,3 @@ jobs: git config --global user.email 'github-actions[bot]@users.noreply.github.com' git tag -a v${{ steps.get_version.outputs.version }} -m "Release version ${{ steps.get_version.outputs.version }}" git push origin v${{ steps.get_version.outputs.version }} - continue-on-error: true - - - name: Publish to JSR - run: deno publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd449da..6c95079 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,4 +27,4 @@ jobs: run: deno install --allow-scripts - name: Run tests - run: deno task test + run: deno task --recursive test