diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 673c95d..634310e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,65 +1,51 @@ name: Deploy to GitHub Pages on: - # Trigger the workflow every time you push to the `main` branch - # Using a different branch name? Replace `main` with your branch’s name push: - branches: [main] - - # Allows you to run this workflow manually from the Actions tab on GitHub. - workflow_dispatch: - -# Allow this job to clone the repo and create a page deployment -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false + branches: 'main' jobs: - build: + build_site: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 + # If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` + # - name: Install pnpm + # uses: pnpm/action-setup@v3 + # with: + # version: 8 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 - cache: pnpm + cache: npm - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm install - - name: Setup Pages - uses: actions/configure-pages@v3 - with: - static_site_generator: sveltekit - - - name: Build - run: pnpm run build + - name: build + env: + BASE_PATH: '/${{ github.event.repository.name }}' + run: | + npm run build - name: Upload Artifacts - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: # this should match the `pages` option in your adapter-static options path: 'build/' deploy: - needs: build + needs: build_site runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -67,4 +53,4 @@ jobs: steps: - name: Deploy id: deployment - uses: actions/deploy-pages@v1 + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index a1ee15d..f9d6089 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -11,8 +11,13 @@ 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 + } } }; -export default config; +export default config; \ No newline at end of file