requirements change 10 #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy MkDocs | |
on: | |
push: | |
branches: | |
- docs # Trigger on pushes to the docs branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' # Use the desired Python version | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt # Install dependencies from requirements.txt | |
- name: Build documentation | |
run: mkdocs build # Build the documentation | |
- name: Checkout site branch | |
run: | | |
if git show-ref --verify --quiet refs/heads/site; then | |
echo "برنچ site وجود دارد." | |
git checkout site | |
else | |
echo "برنچ site وجود ندارد. در حال ایجاد..." | |
git checkout -b site # Create and switch to the new branch | |
fi | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
- name: Replace site contents | |
run: | | |
rm -rf * # Remove existing files in the site branch | |
echo "google-site-verification: googlee5febdfb3cd460f8.html" > googlee5febdfb3cd460f8.html | |
# Move new files from the build directory to the site branch only if they exist | |
if [ -d ../site ]; then | |
mv ../site/* ./ # Move new files from the build directory to the site branch | |
else | |
echo "Directory '../site' does not exist. No files to move." | |
fi | |
- name: Commit changes | |
run: | | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Update documentation" # Only commit if there are changes | |
- name: Setup SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Push changes | |
run: | | |
git remote set-url origin [email protected]:ProdByGodfather/abarorm.git | |
git push origin site |