Skip to content

Commit 180abff

Browse files
committed
implement ci/pages deployment (attempt 1)
1 parent 732f9c6 commit 180abff

File tree

5 files changed

+75
-4
lines changed

5 files changed

+75
-4
lines changed

.github/workflows/pages.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Bun
26+
uses: oven-sh/setup-bun@v1
27+
with:
28+
bun-version: "latest"
29+
cache: true
30+
31+
- name: Install dependencies
32+
run: bun i --frozen-lockfile
33+
34+
- name: Build
35+
run: bun run build
36+
37+
- name: Upload Pages artifact
38+
if: github.event_name == "push"
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: dist
42+
43+
deploy:
44+
if: github.event_name == "push"
45+
needs: build
46+
runs-on: ubuntu-latest
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"canvg": "^4.0.3",
2121
"html2canvas": "^1.4.1",
2222
"mime": "^4.1.0",
23-
"pdftoimg-js": "^0.2.5"
23+
"pdftoimg-js": "^0.2.5",
24+
"vite-plugin-static-copy": "^3.1.6"
2425
}
2526
}

src/handlers/FFmpeg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FFmpegHandler implements FormatHandler {
3131
async loadFFmpeg () {
3232
if (!this.#ffmpeg) return;
3333
return await this.#ffmpeg.load({
34-
coreURL: "/node_modules/@ffmpeg/core/dist/esm/ffmpeg-core.js"
34+
coreURL: "/convert/wasm/ffmpeg-core.js"
3535
});
3636
}
3737
terminateFFmpeg () {

src/handlers/ImageMagick.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ImageMagickHandler implements FormatHandler {
2020

2121
async init () {
2222

23-
const wasmLocation = "/node_modules/@imagemagick/magick-wasm/dist/magick.wasm";
23+
const wasmLocation = "/convert/wasm/magick.wasm";
2424
const wasmBytes = await fetch(wasmLocation).then(r => r.bytes());
2525

2626
await initializeImageMagick(wasmBytes);

vite.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
import { defineConfig } from "vite";
2+
import { viteStaticCopy } from "vite-plugin-static-copy";
23

34
export default defineConfig({
45
optimizeDeps: {
56
exclude: [
67
"@ffmpeg/ffmpeg",
78
]
8-
}
9+
},
10+
base: "/convert/",
11+
plugins: [
12+
viteStaticCopy({
13+
targets: [
14+
{
15+
src: "node_modules/@ffmpeg/core/dist/esm/ffmpeg-core.*",
16+
dest: "wasm"
17+
},
18+
{
19+
src: "node_modules/@imagemagick/magick-wasm/dist/magick.wasm",
20+
dest: "wasm"
21+
}
22+
]
23+
})
24+
]
925
});

0 commit comments

Comments
 (0)