Skip to content

Commit ac5e431

Browse files
committed
GitHub Pagesへデプロイする設定を追加
1 parent b1780fa commit ac5e431

File tree

3 files changed

+74
-21
lines changed

3 files changed

+74
-21
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 静的コンテンツを GitHub Pages にデプロイするためのシンプルなワークフロー
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# デフォルトブランチを対象としたプッシュ時にで実行されます
6+
push:
7+
branches: ["main"]
8+
9+
# Actions タブから手動でワークフローを実行できるようにします
10+
workflow_dispatch:
11+
12+
# GITHUB_TOKEN のパーミッションを設定し、GitHub Pages へのデプロイを許可します
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# 1 つの同時デプロイメントを可能にする
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# デプロイするだけなので、単一のデプロイジョブ
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Set up Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: "npm"
38+
- name: Install dependencies
39+
run: npm ci
40+
- name: Build
41+
run: npm run build
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
# dist フォルダーのアップロード
48+
path: "./dist"
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

eslint.config.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import react from 'eslint-plugin-react'
4-
import reactHooks from 'eslint-plugin-react-hooks'
5-
import reactRefresh from 'eslint-plugin-react-refresh'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import react from "eslint-plugin-react";
4+
import reactHooks from "eslint-plugin-react-hooks";
5+
import reactRefresh from "eslint-plugin-react-refresh";
66

77
export default [
8-
{ ignores: ['dist'] },
8+
{ ignores: ["dist"] },
99
{
10-
files: ['**/*.{js,jsx}'],
10+
env: { node: true },
11+
files: ["**/*.{js,jsx}"],
1112
languageOptions: {
1213
ecmaVersion: 2020,
1314
globals: globals.browser,
1415
parserOptions: {
15-
ecmaVersion: 'latest',
16+
ecmaVersion: "latest",
1617
ecmaFeatures: { jsx: true },
17-
sourceType: 'module',
18+
sourceType: "module",
1819
},
1920
},
20-
settings: { react: { version: '18.3' } },
21+
settings: { react: { version: "18.3" } },
2122
plugins: {
2223
react,
23-
'react-hooks': reactHooks,
24-
'react-refresh': reactRefresh,
24+
"react-hooks": reactHooks,
25+
"react-refresh": reactRefresh,
2526
},
2627
rules: {
2728
...js.configs.recommended.rules,
2829
...react.configs.recommended.rules,
29-
...react.configs['jsx-runtime'].rules,
30+
...react.configs["jsx-runtime"].rules,
3031
...reactHooks.configs.recommended.rules,
31-
'react/jsx-no-target-blank': 'off',
32-
'react-refresh/only-export-components': [
33-
'warn',
32+
"react/jsx-no-target-blank": "off",
33+
"react-refresh/only-export-components": [
34+
"warn",
3435
{ allowConstantExport: true },
3536
],
3637
},
3738
},
38-
]
39+
];

vite.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react-swc'
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react-swc";
33

4-
// https://vite.dev/config/
4+
// https://vitejs.dev/config/
55
export default defineConfig({
6+
base: process.env.GITHUB_PAGES ? "REPOSITORY_NAME" : "./",
67
plugins: [react()],
7-
})
8+
});

0 commit comments

Comments
 (0)