Skip to content

CI correction

CI correction #35

# Copyright 2024 CS Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Generate documentation
# TODO: when to generate the doc ?
# For now, only for new git tags (including hierarchical tags like v1.0/beta), or manually
on:
push:
workflow_dispatch:
env:
PYTHON_VERSION: 3.11
jobs:
generate-documentation:
name: Generate documentation
runs-on: ubuntu-latest
permissions:
packages: read # to pull docker images when running build_aggregated_openapi.sh
contents: write # to publish the generated documentation
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/poetry-install
with:
options: ""
working-directory: .
- name: Checkout RS-Server
run: |
set -x
pwd
ls -all
cd docs
git clone -b feat-rspy112/improve-documentation https://github.com/RS-PYTHON/rs-server.git
working-directory: .
shell: bash
# The technical documentation uses a dedicated python project to be built
- uses: ./.github/actions/poetry-install
with:
working-directory: ./docs/rs-server/
# To pull ghcr.io/rs-python/apikey-manager
# TODO: to be changed when the apikey manager will have its own container registry.
- name: Log into Docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate REST API (Swagger) HTML documentation
run: |
set -x
pwd
ls -all
sleep 2
cd docs/rs-server/
# Generate the aggregated openapi.json/swagger
echo 'Generate the aggregated openapi.json/swagger'
./services/frontend/resources/build_aggregated_openapi.sh --run-services --set-version
# Copy it beside the index.html
echo 'Copy openapi.json in rest directory'
cp ./services/frontend/resources/openapi.json ./docs/doc/api/rest/
shell: bash
- name: Deploy docs to ghpages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./site
- name: Generate Markdown HTML documentation
run: |
set -x
pwd
ls -all
python -m venv ./venv_mkdocs/
sleep 2
source venv_mkdocs/bin/activate
rm -rf poetry.lock && poetry lock --no-update && poetry install
cd docs/rs-server
rm -rf poetry.lock && poetry lock --no-update && poetry install --with dev
cd ../../
poetry mkdocs gh-deploy --force
working-directory: .
shell: bash
# - run: >
# echo "Documentation published to: https://rs-python.github.io/rs-server" >> $GITHUB_STEP_SUMMARY