From 0ad2bc22417eb147acd5aaf15b10f749c47a1a6c Mon Sep 17 00:00:00 2001 From: nderevj Date: Wed, 28 Jan 2026 16:56:41 -0800 Subject: [PATCH 1/4] deploy check script --- deno.jsonc | 1 + deno.lock | 18 ++++++++++++++++-- tools/deno.jsonc | 4 +++- tools/deploy-check.ts | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 tools/deploy-check.ts diff --git a/deno.jsonc b/deno.jsonc index 24b7d86..37a53e6 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -7,6 +7,7 @@ "check": "deno task compile:check && deno task lint:check && deno task fmt:check", "compile:check": "deno check", "deploy": "deno task build && deno run --allow-net --allow-read --allow-env --env tools/deploy.ts", + "deploy:check": "deno run --allow-net --allow-env tools/deploy-check.ts", "dev": "deno run --allow-net --allow-read jsr:@std/http/file-server src/", "dev:dist": "deno task build && deno run --allow-net --allow-read jsr:@std/http/file-server dist/", "dist": "deno run --allow-read --allow-write --allow-env tools/dist.ts", diff --git a/deno.lock b/deno.lock index fbd0c26..2c115af 100644 --- a/deno.lock +++ b/deno.lock @@ -1,18 +1,30 @@ { "version": "5", "specifiers": { + "jsr:@b-fuze/deno-dom@*": "0.1.56", + "jsr:@std/assert@*": "1.0.13", "jsr:@std/fs@*": "1.0.22", "jsr:@std/internal@^1.0.12": "1.0.12", + "jsr:@std/internal@^1.0.6": "1.0.12", "jsr:@std/path@*": "1.1.4", "jsr:@std/path@^1.1.4": "1.1.4", "npm:@types/ssh2-sftp-client@*": "9.0.6", "npm:ssh2-sftp-client@*": "12.0.1" }, "jsr": { + "@b-fuze/deno-dom@0.1.56": { + "integrity": "8030e2dc1d8750f1682b53462ab893d9c3470f2287feecbe22f44a88c54ab148" + }, + "@std/assert@1.0.13": { + "integrity": "ae0d31e41919b12c656c742b22522c32fb26ed0cba32975cb0de2a273cb68b29", + "dependencies": [ + "jsr:@std/internal@^1.0.6" + ] + }, "@std/fs@1.0.22": { "integrity": "de0f277a58a867147a8a01bc1b181d0dfa80bfddba8c9cf2bacd6747bcec9308", "dependencies": [ - "jsr:@std/internal", + "jsr:@std/internal@^1.0.12", "jsr:@std/path@^1.1.4" ] }, @@ -22,7 +34,7 @@ "@std/path@1.1.4": { "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5", "dependencies": [ - "jsr:@std/internal" + "jsr:@std/internal@^1.0.12" ] } }, @@ -142,6 +154,8 @@ "members": { "tools": { "dependencies": [ + "jsr:@b-fuze/deno-dom@*", + "jsr:@std/assert@*", "jsr:@std/fs@*", "jsr:@std/path@*", "npm:ssh2-sftp-client@*" diff --git a/tools/deno.jsonc b/tools/deno.jsonc index 4a8d81d..adc828b 100644 --- a/tools/deno.jsonc +++ b/tools/deno.jsonc @@ -2,6 +2,8 @@ "imports": { "@std/fs": "jsr:@std/fs", "@std/path": "jsr:@std/path", - "ssh2-sftp-client": "npm:ssh2-sftp-client" + "@std/assert": "jsr:@std/assert", + "ssh2-sftp-client": "npm:ssh2-sftp-client", + "@b-fuze/deno-dom": "jsr:@b-fuze/deno-dom" } } diff --git a/tools/deploy-check.ts b/tools/deploy-check.ts new file mode 100644 index 0000000..c2a85e7 --- /dev/null +++ b/tools/deploy-check.ts @@ -0,0 +1,18 @@ +import { assertEquals } from "@std/assert"; +import { DOMParser } from "@b-fuze/deno-dom"; + +const scriptName = import.meta.url.split("/").pop(); +const url = Deno.args[0]; +const semver = Deno.env.get("TAG")?.replace(/^v/, ""); + +if (!url || !semver) { + console.error(`Usage: TAG=v1.2.3 deno run --allow-net --allow-env ${scriptName} `); + Deno.exit(1); +} + +const result = await fetch(url); +const html = await result.text(); +const document = new DOMParser().parseFromString(html, "text/html"); +const version = document.querySelector('meta[name="version"]')?.getAttribute("content"); + +assertEquals(version, semver, "deployed version"); From 91763216dcade2dcf94eb359147e57cb2d7839b9 Mon Sep 17 00:00:00 2001 From: nderevj Date: Wed, 28 Jan 2026 17:06:09 -0800 Subject: [PATCH 2/4] made tag a command line arg --- tools/deploy-check.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/deploy-check.ts b/tools/deploy-check.ts index c2a85e7..7d33d67 100644 --- a/tools/deploy-check.ts +++ b/tools/deploy-check.ts @@ -3,10 +3,10 @@ import { DOMParser } from "@b-fuze/deno-dom"; const scriptName = import.meta.url.split("/").pop(); const url = Deno.args[0]; -const semver = Deno.env.get("TAG")?.replace(/^v/, ""); +const semver = Deno.args[1]?.replace(/^v/, ""); if (!url || !semver) { - console.error(`Usage: TAG=v1.2.3 deno run --allow-net --allow-env ${scriptName} `); + console.error(`Usage: deno run --allow-net --allow-env ${scriptName} `); Deno.exit(1); } From 31fcc9cd376adcd60295fdbec8cbcb3d6d0a7517 Mon Sep 17 00:00:00 2001 From: nderevj Date: Wed, 28 Jan 2026 17:06:24 -0800 Subject: [PATCH 3/4] updated the stg deploy workflow --- .github/workflows/deploy-stg.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-stg.yml b/.github/workflows/deploy-stg.yml index b5a381d..4e0b47e 100644 --- a/.github/workflows/deploy-stg.yml +++ b/.github/workflows/deploy-stg.yml @@ -15,9 +15,10 @@ jobs: environment: name: stg - url: https://stg.networkbasedsolutions.com + url: ${{ env.DEPLOYMENT_URL }} env: + DEPLOYMENT_URL: https://stg.networkbasedsolutions.com TAG: ${{ github.ref_name }} SFTP_HOST: ${{ vars.SFTP_HOST }} SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }} @@ -37,7 +38,11 @@ jobs: - name: Deploy to Staging run: deno task deploy + - name: Check Deployment + run: deno task deploy:check "${{ env.DEPLOYMENT_URL }}" "${{ env.TAG }}" + - name: Archive Artifacts + if: ${{ !cancelled() }} uses: actions/upload-artifact@v6 with: if-no-files-found: error From 14eba464ffe094170de53e4d74fc3617422c9789 Mon Sep 17 00:00:00 2001 From: nderevj Date: Wed, 28 Jan 2026 17:08:55 -0800 Subject: [PATCH 4/4] updated the prod deploy workflow --- .github/workflows/deploy-prod.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index f3ef1a2..8e7c823 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -15,9 +15,10 @@ jobs: environment: name: prod - url: https://networkbasedsolutions.com + url: ${{ env.DEPLOYMENT_URL }} env: + DEPLOYMENT_URL: https://networkbasedsolutions.com TAG: ${{ github.ref_name }} SFTP_HOST: ${{ vars.SFTP_HOST }} SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }} @@ -37,7 +38,11 @@ jobs: - name: Deploy to Production run: deno task deploy + - name: Check Deployment + run: deno task deploy:check "${{ env.DEPLOYMENT_URL }}" "${{ env.TAG }}" + - name: Archive Artifacts + if: ${{ !cancelled() }} uses: actions/upload-artifact@v6 with: if-no-files-found: error