-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2c417c8
Showing
384 changed files
with
37,785 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @1ilsang |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: netlify-preview | ||
|
||
inputs: | ||
NETLIFY_SITE_ID: | ||
required: true | ||
NETLIFY_API_TOKEN: | ||
required: true | ||
HEAD_COMMIT: | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
# https://cli.netlify.com/ | ||
- name: Netlify deploy | ||
id: netlify-deploy | ||
shell: bash | ||
run: | | ||
pnpm nf deploy \ | ||
--dir out \ | ||
--site ${{ inputs.NETLIFY_SITE_ID }} \ | ||
--auth ${{ inputs.NETLIFY_API_TOKEN }} \ | ||
--json \ | ||
> deploy_output.json | ||
- name: Generate URL Preview | ||
id: url-preview | ||
shell: bash | ||
# pnpm 샌드박스 로그가 json 파일에 상단에 추가되는 버그가 있음. | ||
# 로그 삭제후 5번째 라인부터 JSON 파일 재생성 | ||
run: | | ||
tail -n +5 deploy_output.json > parsed_output.json | ||
echo $(cat parsed_output.json) | ||
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' parsed_output.json) | ||
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> "$GITHUB_OUTPUT" | ||
- name: Comment URL Preview on PR | ||
# https://octokit.github.io/rest.js/v20 | ||
uses: actions/github-script@v7 | ||
env: | ||
NETLIFY_PREVIEW_URL: ${{ steps.url-preview.outputs.NETLIFY_PREVIEW_URL }} | ||
HEAD_COMMIT: ${{ inputs.HEAD_COMMIT }} | ||
with: | ||
script: | | ||
const owner = context.repo.owner; | ||
const repo = context.repo.repo; | ||
async function getIssueNumber() { | ||
const result = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
owner, | ||
repo, | ||
commit_sha: process.env.HEAD_COMMIT, | ||
}); | ||
const issueNumber = result.data[0]?.number; | ||
return issueNumber; | ||
} | ||
async function getExistPrevActionBot(issueNumber) { | ||
const result = await github.rest.issues.listComments({ | ||
owner, | ||
repo, | ||
issue_number: issueNumber | ||
}); | ||
const existPrevAction = result.data.find(comment => comment.user.login === 'github-actions[bot]'); | ||
return existPrevAction; | ||
} | ||
async function comment(){ | ||
const issueNumber = await getIssueNumber(); | ||
if (!issueNumber) { | ||
console.log('No PR found for commit ' + process.env.HEAD_COMMIT); | ||
return; | ||
} | ||
const prevActionBot = await getExistPrevActionBot(issueNumber); | ||
const body = `Preview URL: ${process.env.NETLIFY_PREVIEW_URL}`; | ||
if (prevActionBot?.id) { | ||
await github.rest.issues.updateComment({ | ||
owner, | ||
repo, | ||
comment_id: prevActionBot.id, | ||
body | ||
}); | ||
} else { | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: issueNumber, | ||
body | ||
}); | ||
} | ||
} | ||
comment(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action?platform=mac#creating-an-action-metadata-file | ||
name: nextjs-build-export | ||
|
||
inputs: | ||
e2e: | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Restore Next.js related caches | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
${{ github.workspace }}/.next | ||
${{ github.workspace }}/out | ||
key: ${{ runner.os }}-nextjs-store-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx', '**.md', '**.html', '**.png') }}-${{ inputs.e2e == 'true' && 'e2e' || 'default' }} | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-store-${{ hashFiles('**/pnpm-lock.yaml') }}- | ||
id: cache-nextjs-build | ||
|
||
- name: Build and Export [default] | ||
shell: bash | ||
if: steps.cache-nextjs-build.outputs.cache-hit != 'true' && inputs.e2e == 'false' | ||
run: pnpm build | ||
|
||
- name: Build and Export [e2e] | ||
shell: bash | ||
if: steps.cache-nextjs-build.outputs.cache-hit != 'true' && inputs.e2e == 'true' | ||
run: pnpm e2e:build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: playwright-install | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1373375487 | ||
- name: Get playwright version | ||
shell: bash | ||
run: | | ||
echo "PLAYWRIGHT_VERSION=$(node -e "process.stdout.write(require('@playwright/test/package.json').version)")" >> $GITHUB_OUTPUT | ||
id: playwright-version | ||
|
||
- name: Cache Playwright Browsers for Playwright's Version | ||
uses: actions/cache@v4 | ||
with: | ||
# https://playwright.dev/docs/browsers#managing-browser-binaries | ||
path: ~/Library/Caches/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }} | ||
id: cache-playwright-browsers | ||
|
||
- name: Setup Playwright | ||
shell: bash | ||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | ||
run: pnpm e2e:install |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: pnpm-install | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
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 | ||
shell: bash | ||
run: pnpm install |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: code | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🏁 Lint | ||
run: pnpm lint | ||
|
||
build-export: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🏗 Build and Export | ||
uses: ./.github/actions/nextjs-build-export | ||
|
||
preview: | ||
runs-on: macos-latest | ||
needs: build-export | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# 캐싱 된 값을 사용 | ||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
- name: 🏗 Build and Export | ||
uses: ./.github/actions/nextjs-build-export | ||
|
||
- name: 🌈 Netlify preview | ||
uses: ./.github/actions/netlify-preview | ||
with: | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
NETLIFY_API_TOKEN: ${{ secrets.NETLIFY_API_TOKEN }} | ||
HEAD_COMMIT: ${{ github.event.pull_request.head.sha }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
name: e2e-reusable | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
others: | ||
type: boolean | ||
default: false | ||
dom-snapshot: | ||
type: boolean | ||
default: false | ||
screen-snapshot: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
i: | ||
timeout-minutes: 60 | ||
runs-on: macos-latest | ||
env: | ||
TZ: Asia/Seoul | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🥦 Install playwright | ||
uses: ./.github/actions/playwright-install | ||
|
||
- name: 🏗 Build and Export | ||
uses: ./.github/actions/nextjs-build-export | ||
with: | ||
e2e: 'true' | ||
|
||
- name: 🍄 Run Playwright [others] | ||
if: inputs.others | ||
run: pnpm e2e:others | ||
|
||
- name: 🧊 Run Playwright [dom-snapshot] | ||
if: inputs.dom-snapshot | ||
run: pnpm e2e:dom | ||
|
||
- name: 🩸 Run Playwright [screen-snapshot] | ||
if: inputs.screen-snapshot | ||
run: pnpm e2e:screen | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: playwright-report-$${{ inputs.others && 'others' || inputs.dom-snapshot && 'dom-snapshot' || inputs.screen-snapshot && 'screen-snapshot' || 'no-input-name' }} | ||
path: playwright-report/ | ||
retention-days: 10 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: e2e | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
others: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
others: true | ||
|
||
dom-snapshot: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
dom-snapshot: true | ||
|
||
screen-snapshot: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
screen-snapshot: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: jest | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
jest: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🪤 Jest | ||
run: pnpm jest |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: label-mailto | ||
|
||
on: | ||
issues: | ||
types: [labeled] | ||
|
||
jobs: | ||
send_notification: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Trim issue body to 3 lines | ||
run: | | ||
echo "${{ github.event.issue.body }}" | head -n 3 > trimmed_body.txt | ||
echo "TRIMMED_BODY<<EOF" >> $GITHUB_ENV | ||
while IFS= read -r line; do | ||
echo "$line" >> $GITHUB_ENV | ||
done < trimmed_body.txt | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Send Email Notification | ||
uses: dawidd6/action-send-mail@v3 | ||
env: | ||
TRIMMED_BODY: ${{ env.TRIMMED_BODY }} | ||
with: | ||
secure: true | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
# user credentials | ||
username: ${{ secrets.EMAIL_USERNAME }} | ||
password: ${{ secrets.EMAIL_PASSWORD }} | ||
subject: '[Issue] ${{ github.event.issue.title }}: ${{github.event.label.name}}' | ||
body: "Issue URL: ${{ github.event.issue.html_url }}\n\nBody:\n${{env.TRIMMED_BODY}}" | ||
to: [email protected] | ||
from: 1ilsang.dev |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
node_modules | ||
build | ||
dist | ||
out | ||
.next/ | ||
|
||
.DS_Store | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Playwright | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
# Jest | ||
/coverage/ |
Oops, something went wrong.