Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/deploy-stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 16 additions & 2 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tools/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
18 changes: 18 additions & 0 deletions tools/deploy-check.ts
Original file line number Diff line number Diff line change
@@ -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.args[1]?.replace(/^v/, "");

if (!url || !semver) {
console.error(`Usage: deno run --allow-net --allow-env ${scriptName} <url> <tag>`);
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");