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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Cloudflare Pages
name: Publish and Deploy

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
build:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -31,16 +31,16 @@ jobs:
restore-keys: |
${{ runner.os }}-deno-cache-

- name: Build Project
run: deno task build
- name: Publish Project
run: deno task publish

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: static-files
path: static/
name: dist-files
path: dist/
deploy:
needs: build
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -49,15 +49,15 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: static-files
path: static/
name: dist-files
path: dist/

- name: "List static directory contents"
run: ls -R static
- name: "List publish directory contents"
run: ls -R dist

- name: Deploy to Cloudflare pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy static --project-name=armorynodewebsite
command: pages deploy dist --project-name=armorynodewebsite
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ static/css/*.min.css
# Node modules
node_modules/
# Wrangler
.wrangler/
.wrangler/
# published artifacts
dist/
3 changes: 1 addition & 2 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ async function compileSass() {
// Only run if the script is run directly, not imported as a module
if (import.meta.main) {
await compile();
console.log("✅ Done!");
}

export async function compile() {
Expand All @@ -54,6 +55,4 @@ export async function compile() {

console.log("🌳 Compiling Elm...");
await compileAndMinifyElm();

console.log("✅ Done!");
}
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"tasks": {
"build": "deno run --allow-read --allow-env --allow-write --allow-run build.ts",
"publish": "deno run --allow-read --allow-env --allow-write --allow-run publish.ts",
"run": "deno run --allow-read --allow-env --allow-write --allow-run run.ts"
}
}
13 changes: 13 additions & 0 deletions deno.lock

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

18 changes: 18 additions & 0 deletions publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as fs from "jsr:@std/fs";
import { compile } from "./build.ts";

/// Builds and publishes necessary files to `dist/` for deployment.
async function publish() {
console.log("🏗️ Running build step...");
await compile();

console.log("🚀 Publishing files to `dist/`...");
await Deno.mkdir("./dist", { recursive: true });
await fs.copy("./static", "./dist/static", { overwrite: true });
await fs.copy("./functions", "./dist/functions", { overwrite: true });
await fs.copy("./wrangler.toml", "./dist/wrangler.toml", { overwrite: true });

console.log("✅ Publish complete!");
}

await publish();
Loading