mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 16:34:43 +12:00
ci: separate website deploy
This commit is contained in:
parent
da455bceea
commit
413d6d67c5
5 changed files with 73 additions and 10 deletions
46
.github/workflows/deploy-website.yml
vendored
Normal file
46
.github/workflows/deploy-website.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: Deploy website
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'apps/website/**'
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
deploy-website:
|
||||
name: Deploy website
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: pnpm run build
|
||||
|
||||
- name: Pull vercel production environment
|
||||
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build website Artifacts
|
||||
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build & deploy website
|
||||
uses: BetaHuhn/deploy-to-vercel-action@643bc80032ba62ca41d1a9aaba7b38b51c2b8646
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
VERCEL_SCOPE: 'discordjs'
|
||||
GITHUB_DEPLOYMENT_ENV: 'Production – discord-js'
|
||||
PRODUCTION: true
|
||||
PREBUILT: true
|
21
.github/workflows/documentation.yml
vendored
21
.github/workflows/documentation.yml
vendored
|
@ -5,11 +5,8 @@ on:
|
|||
- 'main'
|
||||
paths:
|
||||
- 'packages/*/src/**'
|
||||
- '!packages/actions/**'
|
||||
- '!packages/create-discord-bot/**'
|
||||
- '!packages/docgen/**'
|
||||
- '!packages/proxy-container/**'
|
||||
- '!packages/scripts/**'
|
||||
- '!packages/ui/**'
|
||||
tags:
|
||||
- '**'
|
||||
|
@ -157,14 +154,29 @@ jobs:
|
|||
uses: ./packages/actions/src/uploadSearchIndices
|
||||
|
||||
deploy-website:
|
||||
needs: [build-docs, build-indices]
|
||||
needs: build-docs
|
||||
name: Deploy website
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: pnpm run build
|
||||
|
||||
- name: Pull vercel production environment
|
||||
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build website Artifacts
|
||||
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build & deploy website
|
||||
uses: BetaHuhn/deploy-to-vercel-action@643bc80032ba62ca41d1a9aaba7b38b51c2b8646
|
||||
with:
|
||||
|
@ -175,3 +187,4 @@ jobs:
|
|||
VERCEL_SCOPE: 'discordjs'
|
||||
GITHUB_DEPLOYMENT_ENV: 'Production – discord-js'
|
||||
PRODUCTION: true
|
||||
PREBUILT: true
|
||||
|
|
|
@ -25,12 +25,11 @@ export async function fetchVersions(packageName: string): Promise<string[]> {
|
|||
|
||||
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown | null> {
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
const res = await readFile(
|
||||
join(process.cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'),
|
||||
'utf8',
|
||||
);
|
||||
let res;
|
||||
|
||||
try {
|
||||
res = await readFile(join(process.cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
||||
|
||||
return JSON.parse(res);
|
||||
} catch {
|
||||
console.log(res);
|
||||
|
|
|
@ -4,6 +4,7 @@ import type { ApiItemKind } from '@discordjs/api-extractor-model';
|
|||
import { VscArrowRight } from '@react-icons/all-files/vsc/VscArrowRight';
|
||||
import { VscSymbolClass } from '@react-icons/all-files/vsc/VscSymbolClass';
|
||||
import { VscSymbolEnum } from '@react-icons/all-files/vsc/VscSymbolEnum';
|
||||
import { VscSymbolEvent } from '@react-icons/all-files/vsc/VscSymbolEvent';
|
||||
import { VscSymbolInterface } from '@react-icons/all-files/vsc/VscSymbolInterface';
|
||||
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
||||
import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty';
|
||||
|
@ -30,6 +31,8 @@ function resolveIcon(item: keyof typeof ApiItemKind) {
|
|||
return <VscSymbolVariable className="shrink-0" size={25} />;
|
||||
case 'Variable':
|
||||
return <VscSymbolVariable className="shrink-0" size={25} />;
|
||||
case 'Event':
|
||||
return <VscSymbolEvent className="shrink-0" size={25} />;
|
||||
default:
|
||||
return <VscSymbolMethod className="shrink-0" size={25} />;
|
||||
}
|
||||
|
@ -98,7 +101,9 @@ export function CmdKDialog() {
|
|||
|
||||
useEffect(() => {
|
||||
const searchDoc = async (searchString: string, version: string) => {
|
||||
const res = await client.index(`${packageName}-${version}`).search(searchString, { limit: 5 });
|
||||
const res = await client
|
||||
.index(`${packageName?.replaceAll('.', '-')}-${version}`)
|
||||
.search(searchString, { limit: 5 });
|
||||
setSearchResults(res.hits);
|
||||
};
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ export async function generateAllIndices({
|
|||
if (writeToFile) {
|
||||
await writeIndexToFileSystem(members, pkg, version);
|
||||
} else {
|
||||
indices.push({ index: `${pkg}-${version.replaceAll('.', '-')}`, data: members });
|
||||
indices.push({ index: `${pkg.replaceAll('.', '-')}-${version.replaceAll('.', '-')}`, data: members });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue