diff --git a/.github/workflows/homepage-deploy.yaml b/.github/workflows/homepage-deploy.yaml new file mode 100644 index 0000000..d8d3fc8 --- /dev/null +++ b/.github/workflows/homepage-deploy.yaml @@ -0,0 +1,43 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - 'main' + +jobs: + build_site: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v1 + + - run: bun install + + - run: bun run build + env: + BASE_PATH: '/${{ github.event.repository.name }}' + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v3 + with: + path: 'build/' + + deploy: + needs: build_site + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 8913898..50dbdb5 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ To publish your library to [npm](https://www.npmjs.com): npm publish ``` +## HomePage + +https://lemo-nade-room.github.io/svelte-diff-highlighting + ## License This software is released under the MIT License. For more details, please refer to the [LICENSE](./LICENSE) file. diff --git a/bun.lockb b/bun.lockb index bcc54ad..4c3d2e1 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 5635570..2b4cb23 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "repository": { "url": "https://github.com/lemo-nade-room/svelte-diff-highlighting" }, + "homepage": "https://lemo-nade-room.github.io/svelte-diff-highlighting", "license": "MIT", "scripts": { "dev": "vite dev", @@ -35,6 +36,7 @@ "devDependencies": { "@playwright/test": "^1.28.1", "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^2.0.0", "@sveltejs/package": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0", diff --git a/svelte.config.js b/svelte.config.js index 35ce421..bbba7e5 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,4 @@ -import adapter from '@sveltejs/adapter-auto'; +import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ @@ -11,7 +11,12 @@ const config = { // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://kit.svelte.dev/docs/adapters for more information about adapters. - adapter: adapter(), + adapter: adapter({ + fallback: '404.html' + }), + paths: { + base: process.argv.includes('dev') ? '' : process.env.BASE_PATH + }, alias: { $sample: './src/sample' }