Skip to content

Commit

Permalink
Merge pull request #24 from para7/gh-pages
Browse files Browse the repository at this point in the history
github pages 対応
  • Loading branch information
para7 authored Dec 10, 2024
2 parents d90a008 + 9d375ba commit d009ce6
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 20 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ on:
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Svelte check
run: pnpm check
- name: Lint
run: pnpm lint
- name: Svelte check
run: pnpm check
- name: Run vitest
run: pnpm test run
- name: Build
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Simple workflow for deploying static content to GitHub Pages
name: build and deploy

on:
push:
branches: ['master']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
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: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: build page
run: pnpm build
- uses: actions/upload-pages-artifact@v1
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
with:
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
13 changes: 7 additions & 6 deletions src/lib/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
*
* >> DO NOT EDIT THIS FILE MANUALLY <<
*/
import { base } from '$app/paths'

/**
* PAGES
*/
export const PAGES = {
"/": `/`,
"/about": `/about`,
"/encoder/url": `/encoder/url`,
"/formatter/json": `/formatter/json`,
"/image-converter": `/image-converter`,
"/word-count": `/word-count`
"/": `${base}/`,
"/about": `${base}/about`,
"/encoder/url": `${base}/encoder/url`,
"/formatter/json": `${base}/formatter/json`,
"/image-converter": `${base}/image-converter`,
"/word-count": `${base}/word-count`
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div>
<div class="flex header">
<h1>
<a href="/"> UTILITIES </a>
<a href={PAGES['/']}> UTILITIES </a>
<span> @para7</span>
</h1>

Expand Down
8 changes: 4 additions & 4 deletions src/routes/about/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
文字数をカウントしたり、画像の形式を変換したり。
</p>
<p>
インターネットで検索をかければ大抵欲しいツールは見つかりますが、ソースが公開されていなかったり、サーバーにデータを送っていたり。セキュリティ面の不安から利用を躊躇する場合があります
インターネットで検索をかければ大抵欲しいツールは見つかりますが、ソースが公開されていなかったり、サーバーにデータを送っていそうなことも多いです。セキュリティ面の不安から利用を躊躇してしまいます
</p>
<p>安心して使える自前のツールセットが欲しいと思ったのが、このサイトのモチベーションです。</p>
</div>
Expand All @@ -20,15 +20,15 @@
<li>
極力外部ライブラリの利用を避け、ブラウザネイティブの動作で実現する。外部ライブラリに依存している場合は明示する。
</li>
<li>オープンソース TODO: githubへのリンクを張る</li>
<li>オープンソース <a href="https://github.com/para7/nana-utilities">Github</a></li>
</ul>

<h2>問い合わせ先</h2>
<div class="block">
<p>
機能追加のリクエストや不具合報告ありましたら、今は一旦 github の issue へお願いいたします。
</p>
<p>Pull Requestも歓迎いたします。</p>
<p>Pull Request も歓迎です。</p>
</div>

<h2>サイト構成技術</h2>
Expand All @@ -51,7 +51,7 @@
</tr>
<tr>
<td>hosting</td>
<td>cloudflare</td>
<td>github pages</td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 4 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const config = {
fallback: undefined,
precompress: false,
strict: true
})
}),
paths: {
base: '/nana-utilities'
}
}

// kit: {
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default defineConfig({
plugins: [
kitRoutes({
generated_file_path: 'src/lib/ROUTES.ts',
format: 'object[path]'
format: 'object[path]',
path_base: true
}),
sveltekit()
],
Expand Down

0 comments on commit d009ce6

Please sign in to comment.