feat: lighthouse setting #12
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: lighthouse | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "main" | |
- "dev" | |
types: | |
- opened | |
- synchronize | |
jobs: | |
lighthouseci: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository // 저장소 체크아웃 | |
uses: actions/checkout@v4 | |
- name: Install pnpm // pnpm 설치 | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9.7.0 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build the project | |
env: | |
AUTH_KAKAO_ID: ${{ secrets.AUTH_KAKAO_ID }} | |
AUTH_KAKAO_SECRET: ${{ secrets.AUTH_KAKAO_SECRET }} | |
AUTH_SECRET: ${{ secrets.AUTH_SECRET }} | |
AUTH_URL: ${{ secrets.AUTH_URL }} | |
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | |
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
NEXT_PUBLIC_NEXTAUTH_SECRET: ${{ secrets.NEXT_PUBLIC_NEXTAUTH_SECRET }} | |
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION: ${{ secrets.NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION }} | |
NEXT_PUBLIC_METADATABASE: ${{ secrets.NEXT_PUBLIC_METADATABASE }} | |
NEXT_PUBLIC_OPENGRAPH_URL: ${{ secrets.NEXT_PUBLIC_OPENGRAPH_URL }} | |
run: pnpm run build | |
- name: Run Lighthouse CI // Lighthouse 실행 | |
env: | |
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | |
run: | | |
pnpm i -g @lhci/cli | |
lhci autorun || echo "Fail to Run Lighthouse CI!" | |
- name: Format lighthouse score | |
id: format_lighthouse_score | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const script = require('./scripts/lhciFormat.js') | |
await script({core}) | |
- name: comment result | |
uses: unsplash/[email protected] | |
with: | |
msg: ${{ steps.format_lighthouse_score.outputs.comments }} |