From 92afcdea8f8cb89fa63f296d4053193a751fa8d2 Mon Sep 17 00:00:00 2001 From: Dakurei Date: Fri, 31 May 2024 15:36:59 +0200 Subject: [PATCH] Adds workflow to auto generate doc & make it accessible on Github (#1645) * Adds workflow to auto generate doc & make it accessible on Github * Adds a condition similar to deploy.yml + There's no particular reason to build the documentation for each fork, as it will simply be possible to synchronize the gh-pages branch via the interface or terminal --- .github/workflows/github-pages.yml | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 00000000000..a648f792b2b --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,64 @@ +name: "Github Pages" + +on: + push: + branches: + - main + +jobs: + pages: + name: Github Pages + if: github.repository == 'pagefaultgames/pokerogue' + runs-on: ubuntu-latest + env: + api-dir: ./ + + strategy: + fail-fast: false + + steps: + - name: Checkout repository for Typedoc + uses: actions/checkout@v3 + with: + path: pokerogue_docs + + - name: Install OS package + run: | + sudo apt update + sudo apt install -y git openssh-client + + - name: Setup Node 20.13.1 + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Checkout repository for Github Pages + uses: actions/checkout@v3 + with: + path: pokerogue_gh + ref: gh-pages + + - name: Install Node.js dependencies + working-directory: ${{env.api-dir}} + run: | + cd pokerogue_docs + npm ci + npm install typedoc --save-dev + + - name: Generate Typedoc docs + working-directory: ${{env.api-dir}} + run: | + cd pokerogue_docs + npx typedoc --out /tmp/docs --githubPages false --entryPoints ./src/ + + - name: Commit & Push docs + run: | + cd pokerogue_gh + git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + mkdir -p $GITHUB_REF_NAME + rm -rf $GITHUB_REF_NAME/* + cp -r /tmp/docs/. $GITHUB_REF_NAME + git add $GITHUB_REF_NAME + git commit --allow-empty -m "[skip ci] Deploy docs" + git push \ No newline at end of file