feat: discord.js 14.14 #172
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
name: Documentation | |
on: | |
push: | |
branches: | |
- 'dev' | |
- 'stable' | |
- '!docs' | |
tags: | |
- '*' | |
jobs: | |
build: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
outputs: | |
BRANCH_NAME: ${{ steps.env.outputs.BRANCH_NAME }} | |
BRANCH_OR_TAG: ${{ steps.env.outputs.BRANCH_OR_TAG }} | |
SHA: ${{ steps.env.outputs.SHA }} | |
if: github.repository_owner == 'pikokr' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install node.js v18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build docs | |
run: pnpm run docs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: docs/docs.json | |
- name: Set outputs for upload job | |
id: env | |
run: | | |
echo "::set-output name=BRANCH_NAME::${GITHUB_REF_NAME}" | |
echo "::set-output name=BRANCH_OR_TAG::${GITHUB_REF_TYPE}" | |
echo "::set-output name=SHA::${GITHUB_SHA}" | |
upload: | |
name: Upload Documentation | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_NAME: ${{ needs.build.outputs.BRANCH_NAME }} | |
BRANCH_OR_TAG: ${{ needs.build.outputs.BRANCH_OR_TAG }} | |
SHA: ${{ needs.build.outputs.SHA }} | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: docs | |
- name: Checkout docs repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'pikokr/docs' | |
token: ${{ secrets.PIKOKR_DOCS }} | |
path: 'out' | |
- name: Move docs to correct directory | |
run: | | |
mkdir -p out/command.ts | |
mv docs/docs.json out/command.ts/${BRANCH_NAME}.json | |
- name: Commit and push | |
run: | | |
cd out | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit -m "Docs build for ${BRANCH_OR_TAG} ${BRANCH_NAME}: ${SHA}" || true | |
git push |