Skip to content

Commit

Permalink
Create .gitlab-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ioluc authored Oct 29, 2024
1 parent 74710d3 commit 870a195
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# .gitlab-ci.yml
stages:
- generate_docs

variables:
# Define paths to simplify the CI script
VENV_PATH: "/home/gitlab/venv"

generate_docs:
stage: generate_docs
script:
# Ensure Python and pip are installed, and create a virtual environment
- sudo apt update && sudo apt install -y python3 python3-pip
- python3 -m venv $VENV_PATH
- source $VENV_PATH/bin/activate
- pip install git+https://github.com/docsible/docsible.git

# Generate documentation
- docsible -r ./ -g -o README.md -com -nob

# Check for any changes in the generated documentation
- git config user.name "gitlab-ci"
- git config user.email "[email protected]"
- git add README.md
- if git diff --cached --exit-code; then
echo "No changes to commit";
exit 0;
fi

# Commit and push if there are changes
- echo "Git Remote URL - http://${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
- git commit -m "Automated documentation update by GitLab CI"
- git push "http://${DEPLOY_TOKEN_USER}:${DEPLOY_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" HEAD:main
only:
- main # Run this job only on pushes to the main branch

0 comments on commit 870a195

Please sign in to comment.