feat:github action init #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 任意のワークフローの名前を定義 | ||
name: nextjs-ci | ||
#どのGitHubイベントに対して実行されるかを定義 | ||
on: | ||
# メインブランチにpushがあったときにワークフローを実行 | ||
push: | ||
branches: [ main ] | ||
# メインブランチに対するプルリクエストが作成されたときにワークフローを実行 | ||
pull_request: | ||
branches: [ main ] | ||
# このワークフローで実行されるジョブを定義 | ||
jobs: | ||
# ジョブの名前を定義 | ||
nextjs-ci: | ||
# このジョブを実行する環境(GitHub Actionsランナー)を指定 | ||
# 今回はubuntuを指定 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# 使用するNode.jsのバージョンを定義 | ||
node-version: [18.14.1] | ||
# 自動化したい作業を定義 | ||
steps: | ||
# 実行環境にソースコードを取り込む | ||
- uses: actions/checkout@v3 | ||
# 実行環境に対してNode.jsのセットアップをする | ||
# 作業に任意の名前を定義 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
# Node.jsのセットアップに必要な設定 | ||
uses: actions/setup-node@v3 | ||
with: | ||
# Node.jsのバージョンを指定 | ||
node-version: ${{ matrix.node-version }} | ||
# yarnのキャッシュを使用する設定 | ||
cache: 'yarn' | ||
# 作業に任意の名前を定義 | ||
- name: Install dependencies | ||
# プロジェクトの依存関係をインストール | ||
run: npm install | ||
# 作業に任意の名前を定義 | ||
- name: Format code | ||
# Prettierでフォーマット | ||
run: npm prettier | ||
# 作業に任意の名前を定義 | ||
- name: Lint code | ||
# ESLintで静的解析の実行 | ||
run: npm lint |