mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ci: dramatically speed up docs building
This commit is contained in:
97
.github/workflows/documentation.yml
vendored
97
.github/workflows/documentation.yml
vendored
@@ -24,7 +24,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build documentation
|
name: Build & upload documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
@@ -50,71 +50,6 @@ jobs:
|
|||||||
- name: Build docs
|
- name: Build docs
|
||||||
run: yarn docs
|
run: yarn docs
|
||||||
|
|
||||||
- name: Upload docgen artifacts
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: docgen
|
|
||||||
path: packages/*/docs/docs.json
|
|
||||||
|
|
||||||
- name: Upload api-extractor artifacts
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: api-extractor
|
|
||||||
path: packages/*/docs/docs.api.json
|
|
||||||
|
|
||||||
upload:
|
|
||||||
name: Upload Documentation
|
|
||||||
needs: build
|
|
||||||
strategy:
|
|
||||||
max-parallel: 1
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
package:
|
|
||||||
[
|
|
||||||
'brokers',
|
|
||||||
'builders',
|
|
||||||
'collection',
|
|
||||||
'core',
|
|
||||||
'discord.js',
|
|
||||||
'next',
|
|
||||||
'formatters',
|
|
||||||
'proxy',
|
|
||||||
'rest',
|
|
||||||
'util',
|
|
||||||
'voice',
|
|
||||||
'ws',
|
|
||||||
]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
||||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install node.js v16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./packages/actions/src/yarnCache
|
|
||||||
|
|
||||||
- name: Build actions
|
|
||||||
run: yarn workspace @discordjs/actions build
|
|
||||||
|
|
||||||
- name: Download docgen artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: docgen
|
|
||||||
path: docs
|
|
||||||
|
|
||||||
- name: Download api-extractor artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: api-extractor
|
|
||||||
path: docs
|
|
||||||
|
|
||||||
- name: Checkout docs repository
|
- name: Checkout docs repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@@ -130,7 +65,7 @@ jobs:
|
|||||||
tag: ${{ github.ref_name }}
|
tag: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Upload documentation to database
|
- name: Upload documentation to database
|
||||||
if: ${{ github.ref_type == 'tag' && matrix.package == steps.extract-tag.outputs.package }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
uses: ./packages/actions/src/uploadDocumentation
|
uses: ./packages/actions/src/uploadDocumentation
|
||||||
@@ -139,16 +74,15 @@ jobs:
|
|||||||
version: ${{ steps.extract-tag.outputs.semver }}
|
version: ${{ steps.extract-tag.outputs.semver }}
|
||||||
|
|
||||||
- name: Move docs to correct directory
|
- name: Move docs to correct directory
|
||||||
if: ${{ github.ref_type == 'tag' && matrix.package == steps.extract-tag.outputs.package }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
env:
|
env:
|
||||||
PACKAGE: ${{ steps.extract-tag.outputs.package }}
|
PACKAGE: ${{ steps.extract-tag.outputs.package }}
|
||||||
SEMVER: ${{ steps.extract-tag.outputs.semver }}
|
SEMVER: ${{ steps.extract-tag.outputs.semver }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p out/${PACKAGE}
|
mkdir -p "out/${PACKAGE}"
|
||||||
if [[ $PACKAGE == "discord.js" ]]; then
|
if [[ "${PACKAGE}" == "discord.js" ]]; then
|
||||||
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${SEMVER}.json
|
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${SEMVER}.json
|
||||||
fi
|
else
|
||||||
if [[ $PACKAGE != "discord.js" ]]; then
|
|
||||||
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${SEMVER}.api.json
|
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${SEMVER}.api.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -158,20 +92,23 @@ jobs:
|
|||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
uses: ./packages/actions/src/uploadDocumentation
|
uses: ./packages/actions/src/uploadDocumentation
|
||||||
with:
|
with:
|
||||||
package: ${{ matrix.package }}
|
package: ${{ steps.extract-tag.outputs.package }}
|
||||||
|
|
||||||
- name: Move docs to correct directory
|
- name: Move docs to correct directory
|
||||||
if: ${{ github.ref_type == 'branch' }}
|
if: ${{ github.ref_type == 'branch' }}
|
||||||
env:
|
env:
|
||||||
PACKAGE: ${{ matrix.package }}
|
PACKAGE: ${{ steps.extract-tag.outputs.package }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p out/${PACKAGE}
|
declare -a PACKAGES=("brokers" "builders" "collection" "core" "discord.js" "next" "formatters" "proxy" "rest" "util" "voice" "ws")
|
||||||
if [[ $PACKAGE == "discord.js" ]]; then
|
for PACKAGE in "${PACKAGES[@]}"; do
|
||||||
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${GITHUB_REF_NAME}.json
|
if [[ "${PACKAGE}" == "discord.js" ]]; then
|
||||||
fi
|
mkdir -p "out/${PACKAGE}"
|
||||||
if [[ $PACKAGE != "discord.js" ]]; then
|
mv "docs/${PACKAGE}/docs/docs.json" "out/${PACKAGE}/${GITHUB_REF_NAME}.json"
|
||||||
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${GITHUB_REF_NAME}.api.json
|
else
|
||||||
|
mkdir -p "out/${PACKAGE}"
|
||||||
|
mv "docs/${PACKAGE}/docs/docs.api.json" "out/${PACKAGE}/${GITHUB_REF_NAME}.api.json"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Commit and push
|
- name: Commit and push
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -88,9 +88,9 @@
|
|||||||
*
|
*
|
||||||
* DEFAULT VALUE: no overrideTsconfig section
|
* DEFAULT VALUE: no overrideTsconfig section
|
||||||
*/
|
*/
|
||||||
// "overrideTsconfig": {
|
"overrideTsconfig": {
|
||||||
// . . .
|
"moduleResolution": "node"
|
||||||
// }
|
}
|
||||||
/**
|
/**
|
||||||
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
|
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
|
||||||
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
|
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
|
||||||
|
|||||||
Reference in New Issue
Block a user