Skip to content

Commit

Permalink
Update deploy.yml and svelte.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ctwhome committed Mar 14, 2024
1 parent fa830e4 commit b2f7d6d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 39 deletions.
60 changes: 23 additions & 37 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,56 @@
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 }}

steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
9 changes: 7 additions & 2 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit b2f7d6d

Please sign in to comment.