Merge pull request #40 from KyeOnDiscord/main #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: "CI" | |
on: | |
push: | |
branches: | |
- '*' | |
- '!docs' | |
tags: | |
- '*' | |
jobs: | |
docgen: | |
if: github.repository_owner == 'fnbrjs' | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup git | |
run: | | |
git config --global user.name "FNBR Bot" | |
git config --global user.email [email protected] | |
- name: Set Up NodeJS | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 22 | |
- name: Checkout Main Repository | |
uses: actions/checkout@v2 | |
with: | |
path: main | |
- name: Checkout Main Repository Docs Branch | |
uses: actions/checkout@v2 | |
with: | |
path: docs | |
ref: docs | |
- name: Checkout DocGen Repository | |
uses: actions/checkout@v2 | |
with: | |
repository: fnbrjs/docgen | |
token: ${{ secrets.BOT_PAT }} | |
path: docgen | |
- name: Install Main Repository Dependencies | |
working-directory: ./main | |
run: npm ci | |
- name: Install DocGen Dependencies | |
working-directory: ./docgen | |
run: npm ci | |
- name: Compile DocGen | |
working-directory: ./docgen | |
run: npm run build | |
- name: Generate Documentation | |
working-directory: ./docgen | |
run: node . ../main | |
- uses: actions-ecosystem/action-regex-match@v2 | |
id: current_branch | |
with: | |
text: ${{ github.ref }} | |
regex: '(?<=\/)(\w|\d|\.)+$' | |
- name: Deploy Documentation | |
working-directory: ./docs | |
shell: bash | |
env: | |
CURRENT_BRANCH: ${{ steps.current_branch.outputs.match }} | |
run: | | |
git pull https://fnbr-bot:${{ secrets.BOT_PAT }}@github.com/fnbrjs/fnbr.js docs | |
mv ../docgen/docs.json ./${CURRENT_BRANCH}.json | |
git add . -A | |
git commit -m "Docs build for ${CURRENT_BRANCH}: ${GITHUB_SHA}" | |
git push https://fnbr-bot:${{ secrets.BOT_PAT }}@github.com/fnbrjs/fnbr.js docs |