diff --git a/.github/workflows/discover-libraries.yml b/.github/workflows/discover-libraries.yml index 62304a5..62d853c 100644 --- a/.github/workflows/discover-libraries.yml +++ b/.github/workflows/discover-libraries.yml @@ -2,8 +2,8 @@ name: Discover Libraries on: schedule: - # 매주 월요일 09:00 UTC (18:00 KST)에 실행 - - cron: "0 9 * * 1" + # 매주 금요일 22:00 KST (13:00 UTC)에 실행 + - cron: "0 13 * * 5" workflow_dispatch: inputs: dry_run: @@ -17,9 +17,6 @@ on: default: "30" type: string -env: - BUN_VERSION: "1.1.26" - jobs: discover: name: Discover New Libraries @@ -32,7 +29,7 @@ jobs: - name: Setup Bun uses: oven-sh/setup-bun@v2 with: - bun-version: ${{ env.BUN_VERSION }} + bun-version: latest - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/generate-content.yml b/.github/workflows/generate-content.yml index fab02da..a446233 100644 --- a/.github/workflows/generate-content.yml +++ b/.github/workflows/generate-content.yml @@ -26,9 +26,6 @@ on: repository_dispatch: types: [library-approved] -env: - BUN_VERSION: "1.1.26" - jobs: generate-content: name: Generate Library Content @@ -42,7 +39,7 @@ jobs: - name: Setup Bun uses: oven-sh/setup-bun@v2 with: - bun-version: ${{ env.BUN_VERSION }} + bun-version: latest - name: Install dependencies run: bun install --frozen-lockfile @@ -70,10 +67,9 @@ jobs: generate-playground: name: Generate Playground Code runs-on: ubuntu-latest - if: ${{ github.event.inputs.content_type == 'playground' || github.event.inputs.content_type == 'both' || github.event_name == 'repository_dispatch' }} needs: [generate-content] - # Run even if content generation is skipped - if: always() + # Run even if content generation is skipped, but only for playground/both types + if: ${{ always() && (github.event.inputs.content_type == 'playground' || github.event.inputs.content_type == 'both' || github.event_name == 'repository_dispatch') }} steps: - name: Checkout repository @@ -82,7 +78,7 @@ jobs: - name: Setup Bun uses: oven-sh/setup-bun@v2 with: - bun-version: ${{ env.BUN_VERSION }} + bun-version: latest - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d597599 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,143 @@ +name: Create Release + +on: + pull_request: + types: [closed] + branches: [main] + +jobs: + release: + name: Create Release Note + runs-on: ubuntu-latest + # PR이 머지되었을 때만 실행 (close만 된 경우 제외) + if: github.event.pull_request.merged == true + + steps: + - name: Checkout trey repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Determine Version Bump + id: bump + run: | + # PR 라벨에서 버전 타입 결정 + LABELS='${{ toJSON(github.event.pull_request.labels.*.name) }}' + + if echo "$LABELS" | grep -q '"major"'; then + echo "type=major" >> $GITHUB_OUTPUT + elif echo "$LABELS" | grep -q '"minor"'; then + echo "type=minor" >> $GITHUB_OUTPUT + elif echo "$LABELS" | grep -q '"patch"'; then + echo "type=patch" >> $GITHUB_OUTPUT + else + # 기본값: patch + echo "type=patch" >> $GITHUB_OUTPUT + fi + + echo "Version bump type: $(cat $GITHUB_OUTPUT | grep type | cut -d= -f2)" + + - name: Get Latest Version & Calculate New Version + id: version + env: + GH_TOKEN: ${{ secrets.RELEASE_PAT }} + run: | + # 최신 릴리즈 버전 가져오기 + LATEST=$(gh release list --repo UseTrey/.github --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null || echo "") + + if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then + # 첫 릴리즈 + LATEST="v0.0.0" + fi + + echo "Latest version: $LATEST" + + # v 접두사 제거하고 파싱 + VERSION="${LATEST#v}" + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + # 숫자가 아니면 0으로 초기화 + MAJOR=${MAJOR:-0} + MINOR=${MINOR:-0} + PATCH=${PATCH:-0} + + # 버전 증가 + BUMP_TYPE="${{ steps.bump.outputs.type }}" + + case $BUMP_TYPE in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + esac + + NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "New version: $NEW_VERSION" + + - name: Get Commits Since Last Release + id: commits + env: + GH_TOKEN: ${{ secrets.RELEASE_PAT }} + run: | + # trey 레포의 최근 커밋들 가져오기 + COMMITS=$(git log --oneline -20 --pretty=format:"- %s" 2>/dev/null | head -15) + + # 멀티라인 출력 처리 + echo "commits<> $GITHUB_OUTPUT + echo "$COMMITS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Release on UseTrey/.github + env: + GH_TOKEN: ${{ secrets.RELEASE_PAT }} + VERSION: ${{ steps.version.outputs.new_version }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_URL: ${{ github.event.pull_request.html_url }} + MERGED_BY: ${{ github.event.pull_request.merged_by.login }} + BUMP_TYPE: ${{ steps.bump.outputs.type }} + COMMITS: ${{ steps.commits.outputs.commits }} + run: | + # Release notes 생성 + NOTES=$(cat <> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "- **Version:** ${{ steps.version.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY + echo "- **Bump Type:** ${{ steps.bump.outputs.type }}" >> $GITHUB_STEP_SUMMARY + echo "- **Repository:** UseTrey/.github" >> $GITHUB_STEP_SUMMARY + echo "- **PR:** #${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "[View Release](https://github.com/UseTrey/.github/releases/tag/${{ steps.version.outputs.new_version }})" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/sync-metrics.yml b/.github/workflows/sync-metrics.yml index fea64ee..b13a83d 100644 --- a/.github/workflows/sync-metrics.yml +++ b/.github/workflows/sync-metrics.yml @@ -66,11 +66,10 @@ jobs: run: bun run build - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v3 - with: - publish-dir: "./out" - production-deploy: true - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + run: | + npx netlify-cli deploy \ + --prod \ + --dir=.next \ + --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \ + --site=${{ secrets.NETLIFY_SITE_ID }} timeout-minutes: 5 diff --git a/app/[slug]/detail-page-client.tsx b/app/[slug]/detail-page-client.tsx index e779b05..6f58afc 100644 --- a/app/[slug]/detail-page-client.tsx +++ b/app/[slug]/detail-page-client.tsx @@ -50,6 +50,7 @@ export function DetailPageClient({ data }: DetailPageClientProps) { config={data.playground_config} codeExample={data.code_example} npmPackage={data.npm_package} + playgroundCode={data.playground_code} /> diff --git a/app/admin/candidates/page.tsx b/app/admin/candidates/page.tsx index a2af6cd..971f97c 100644 --- a/app/admin/candidates/page.tsx +++ b/app/admin/candidates/page.tsx @@ -10,7 +10,7 @@ import type { LibraryCandidateRow } from '@/lib/supabase/types'; function LoadingState() { return (
- +
); } @@ -44,15 +44,15 @@ function CandidatesContent() { export default function CandidatesAdminPage() { return ( -
+
{/* 헤더 */} -
+
- +
-

후보 라이브러리 관리

-

+

후보 라이브러리 관리

+

자동 발견된 라이브러리를 검토하고 승인/거절합니다.

@@ -62,20 +62,22 @@ export default function CandidatesAdminPage() {