Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
GITHUB_APP_ID=
GITHUB_APP_PRIVATE_KEY=
GITHUB_INSTALLATION_ID=
GITHUB_TOKEN=
12 changes: 12 additions & 0 deletions .github/workflows/preview-community.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Vercel Preview Community Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.PREVIEW_VERCEL_PROJECT_ID }}
permissions:
contents: read
on:
push:
branches:
Expand All @@ -13,6 +15,16 @@ jobs:
steps:
- name: Checkout the Codebase
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Refresh library star counts
run: npm run generate:library-data
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Deploy on Vercel
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ name: Vercel Production Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
permissions:
contents: read
on:
push:
branches:
- master
- production
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -44,6 +49,16 @@ jobs:
steps:
- name: Checkout the Codebase
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Refresh library star counts
run: npm run generate:library-data
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Deploy on Vercel
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,37 @@ This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-opti

## Generate Data for Libraries page

First, create a GitHub Application.
If GitHub CLI is already authenticated, update the library star counts using
your existing credentials:

Generate a private key for the GitHub application.

Install the application.
```bash
GITHUB_TOKEN="$(gh auth token)" npm run generate:library-data
```

Generate a `.env` file based on the `.env.example` file:
Alternatively, generate a `.env` file based on the `.env.example` file:

```bash
cp .env.example .env
```

Then, you'll need to add the values with your private key, app id and installation id into the `.env`file:
Then, add your personal GitHub access token to the `.env` file:

```bash
GITHUB_APP_ID=
GITHUB_APP_PRIVATE_KEY=
GITHUB_INSTALLATION_ID=
GITHUB_TOKEN=
```

Run the `libraries.js` script to generate the `libraries.json` file:
Then run the generator:

```bash
node libraries.js
npm run generate:library-data
```

Both commands update `src/data/libraries-next.json`.

Production deployments refresh the star counts automatically using the
workflow's built-in GitHub token. The production workflow also runs every
Monday at 06:00 UTC.

## Learn More

To learn more about Next.js, take a look at the following resources:
Expand All @@ -65,4 +70,4 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deploym

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details
Loading
Loading