From f0ec1f68a66fd2209e6568afc171e8836fbe5d19 Mon Sep 17 00:00:00 2001 From: Escande Guillaume Date: Thu, 9 Nov 2023 11:28:57 +0100 Subject: [PATCH] Add github action to build doc and push on github pages --- .github/workflows/doc-gen.yml | 44 +++++++++++++++++++++++++++++++++++ doc/generate.bash | 5 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/doc-gen.yml diff --git a/.github/workflows/doc-gen.yml b/.github/workflows/doc-gen.yml new file mode 100644 index 0000000..918218e --- /dev/null +++ b/.github/workflows/doc-gen.yml @@ -0,0 +1,44 @@ +name: Deploy static documentation on Pages + +on: + push: + branches: ["*"] + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run Doc generation script + run: doc/generate.bash + + - name: Fix permissions + run: sudo chmod -c -R +rX 'doc/docs-site/build' + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: 'doc/docs-sites/build/site/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/doc/generate.bash b/doc/generate.bash index 2510520..d37ae97 100755 --- a/doc/generate.bash +++ b/doc/generate.bash @@ -1,5 +1,7 @@ #!/bin/bash +set -x +set -e # version : 0.1.0 SCRIPT=$(realpath "$0") @@ -10,4 +12,5 @@ echo "Antora build" docker build ${SCRIPTPATH} --no-cache -t syson_doc_generator:local -docker run -v $SCRIPTPATH/..:/usr/app syson_doc_generator:local + +docker run -u $(id -u):$(id -g) -v $SCRIPTPATH/..:/usr/app syson_doc_generator:local