Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodeをv20を使用するように更新 #127

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 36 additions & 21 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
cache: pnpm
- run: pnpm install
- uses: actions/cache@v3
with:
path: dist/cache
key: ${{ runner.os }}-astro-build-${{ github.event_name == 'pull_request' && github.event.pull_request.id || 'main' }}
restore-keys: ${{ runner.os }}-astro-build-
- run: npm run build
- run: pnpm run build
- uses: actions/upload-pages-artifact@v1
if: github.ref == 'refs/heads/main'
with:
Expand All @@ -35,23 +38,29 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run lint
cache: pnpm
- run: pnpm install
- run: pnpm run lint

typecheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run typecheck
cache: pnpm
- run: pnpm install
- run: pnpm run typecheck

validate-blog:
if: startsWith(github.head_ref, 'blog/') && !startsWith(github.head_ref, 'blog/admin/') && github.actor != 'oucc-blog-ci[bot]'
Expand All @@ -60,14 +69,17 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
cache: pnpm
- run: pnpm install
- run: |
git fetch origin main
git diff origin/main..HEAD --name-only | xargs npm run validate-blog --
git diff origin/main..HEAD --name-only | xargs pnpm run validate-blog --

update-blogmeta:
needs: [validate-blog]
Expand All @@ -85,16 +97,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.generate-token.outputs.token }}
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
cache: pnpm
- run: pnpm install
- name: Update Blog Meta
run: |
git fetch origin main
git diff origin/main..HEAD --name-status | xargs npm run update-blogmeta --
- run: npm run format
git diff origin/main..HEAD --name-status | xargs pnpm run update-blogmeta --
- run: pnpm run format
- name: Git Commit
run: |
git add -N .
Expand Down Expand Up @@ -123,4 +138,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.0
20.15.0
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/src/content/blogs
pnpm-lock.yaml
dist
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ OUCC のウェブサイトです。静的サイトジェネレータ Astro を

このプロジェクトでは Prettier によってコードのフォーマットを統一しています。ファイルの保存時に自動的に Prettier でフォーマットするようエディタを設定してください。

このプロジェクトではシンボリックリンクを扱っているので`git config --global core.symlinks true`を設定してください
シンボリックリンクを扱うためclone前に以下のコマンドを実行してください

```sh
git config --global core.symlinks true
```

pnpmを使用しているため以下のコマンドを実行してください。

```sh
corepack enable pnpm
```

## ディレクトリ構成

Expand Down Expand Up @@ -32,17 +42,17 @@ cf. [ディレクトリ構成 🚀 Astroドキュメント](https://docs.astro.b

## コマンド

| Command | Action |
| :------------------------ | :-------------------------------------------------------------------- |
| `npm install` | 開発に必要なパッケージをインストールする |
| `npm run dev` | 開発サーバーを起動する |
| `npm run build` | 本番ビルドを `./dist/out/` に書き出し、ブログのインデックスを作成する |
| `npm run preview` | 書き出した本番ビルドをプレビューする |
| `npm run typecheck` | 型チェックを実行する |
| `npm run lint` | コードのフォーマットが正しいかチェックする |
| `npm run format` | コードのフォーマットを自動で修正する |
| `npm run validate-blog` | 指定したファイルがブログの更新の際に変更して良いか判定します |
| `npm run update-blogmeta` | 指定したファイルに対応するブログのメタ情報を更新します |
| Command | Action |
| :------------------------- | :-------------------------------------------------------------------- |
| `pnpm install` | 開発に必要なパッケージをインストールする |
| `pnpm run dev` | 開発サーバーを起動する |
| `pnpm run build` | 本番ビルドを `./dist/out/` に書き出し、ブログのインデックスを作成する |
| `pnpm run preview` | 書き出した本番ビルドをプレビューする |
| `pnpm run typecheck` | 型チェックを実行する |
| `pnpm run lint` | コードのフォーマットが正しいかチェックする |
| `pnpm run format` | コードのフォーマットを自動で修正する |
| `pnpm run validate-blog` | 指定したファイルがブログの更新の際に変更して良いか判定します |
| `pnpm run update-blogmeta` | 指定したファイルに対応するブログのメタ情報を更新します |

## ブログ

Expand Down
2 changes: 1 addition & 1 deletion README_BLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tags:
以下のようにコマンドを使うことで手動で更新することもできます。

```bash
$ npm run update-blogmeta -- src/content/blogs/NEW-POST1.md src/content/blogs/NEW-POST2.md
$ pnpm run update-blogmeta -- src/content/blogs/NEW-POST1.md src/content/blogs/NEW-POST2.md
```

## 著者の追加
Expand Down
Loading
Loading