Skip to content

Commit

Permalink
github actions static deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
JUB-Yoush committed Apr 16, 2024
1 parent a9f1db1 commit 501725f
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 5 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy to GitHub Pages

on:
push:
branches: 'main'

jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# 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@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm install

- name: build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
run: |
npm run build
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
# this should match the `pages` option in your adapter-static options
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
10 changes: 10 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"autoprefixer": "^10.4.16",
Expand Down
1 change: 1 addition & 0 deletions src/routes/+layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
4 changes: 2 additions & 2 deletions src/routes/projects.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
color: #F5D33D;
background-color: #ec25a0;
font-family: 'Archivo Black';
font-size: calc(28px + 1.5vw);
line-height: calc(28px + 1.5vw);
font-size: calc(20px + 1.5vw);
line-height: calc(20px + 1.5vw);
border-radius: 10px;
min-width:200px;
width:20vw;
Expand Down
15 changes: 12 additions & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import {mdsvex} from 'mdsvex'
import sveltePreprocess from 'svelte-preprocess';

Expand All @@ -9,15 +9,24 @@ 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({
pages:'build',
assets:'build',
fallback: undefined,
precompress: false,
strict:true
}),
paths: {
base: process.argv.includes('dev') ? '' : process.env.BASE_PATH
}
},
extensions:['.svelte','.md'],

preprocess: [
vitePreprocess({}),
mdsvex({
extensions:['.md'],

})
]
};
Expand Down

0 comments on commit 501725f

Please sign in to comment.