From 47df281786632c8c85e5fb666a13f2fc23986940 Mon Sep 17 00:00:00 2001 From: Alix von Schirp Date: Mon, 10 Mar 2025 21:43:49 +0100 Subject: [PATCH] chore: Added documentation workflow Needs testing --- .github/workflows/docs.yaml | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..292273b --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,83 @@ +name: PUBLISH DOCS +on: [workflow_dispatch] + # or set up your own custom triggers +permissions: + contents: write # allows the 'Commit' step without tokens + +jobs: + get_history: # create an artifact from the existing documentation builds + runs-on: ubuntu-latest + steps: + - name: get the gh-pages repo + uses: actions/checkout@v3 + with: + ref: gh-pages + + - name: tar the existing docs + run: | + mkdir -p ./docs + tar -cvf documentation.tar ./docs + + - name: create a document artifact + uses: actions/upload-artifact@v3 + with: + name: documentation + path: documentation.tar + + build: # builds the distribution and then the documentation + needs: get_history + runs-on: ubuntu-latest + steps: + - name: Checkout src + uses: actions/checkout@v3 + + - run: mkdir -p ./docs + - name: Download the existing documents artifact + uses: actions/download-artifact@v3 + with: + name: documentation + - run: tar -xf documentation.tar ./docs -C ./docs + + - name: Build + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + - run: npm ci + - run: npm run build # set up 'build' script in your package.json + + - name: Build documents + run: npm run docs #set up 'docs' build script in your package.json + + - name: tar the new docs + run: tar -cvf newdocumentation.tar ./docs + + - name: create a new document artifact + uses: actions/upload-artifact@v3 + with: + name: newdocumentation + path: newdocumentation.tar + + commit: # commit the old and new merged documents to gh-pages/docs + needs: build + runs-on: ubuntu-latest + steps: + - name: checkout the gh-pages repo + uses: actions/checkout@v3 + with: + ref: gh-pages + + - run: mkdir -p ./docs + - name: Download the new documents artifact + uses: actions/download-artifact@v3 + with: + name: newdocumentation + - run: tar -xf newdocumentation.tar ./docs -C ./docs + + - name: commit + run: | + git config --global user.email "cis-oss@users.noreply.github.com" + git config --global user.name "Continuous Integration" + git add . + git commit -m "CI updated the documentation" + git push \ No newline at end of file