Skip to content

Commit

Permalink
Merge pull request #127 from OUCC/update-node
Browse files Browse the repository at this point in the history
nodeをv20を使用するように更新
  • Loading branch information
miyaji255 authored Jul 10, 2024
2 parents 9e8fa5b + 509e482 commit 6a6f6aa
Show file tree
Hide file tree
Showing 9 changed files with 6,061 additions and 9,206 deletions.
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

0 comments on commit 6a6f6aa

Please sign in to comment.