Skip to content

requirements change 24 #38

requirements change 24

requirements change 24 #38

Workflow file for this run

name: Build and Deploy MkDocs
on:
push:
branches:
- docs # This triggers the workflow when changes are pushed to the 'docs' branch
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
# Step 3: Install required dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt
# Step 4: Build the documentation
- name: Build documentation
run: mkdocs build
# Step 5: Check if the .git directory exists
- name: Check if .git directory exists
run: |
if [ ! -d ".git" ]; then
echo "Initializing git repository..."
git init # Initialize Git repository if it's not already initialized
git remote add origin git@github.com:ProdByGodfather/abarorm.git # Add remote repository
git fetch origin # Fetch from the remote repository to get history
else
echo ".git directory exists."
fi
# Step 6: Checkout or create the 'site' branch
- name: Checkout site branch
run: |
git fetch origin
if git show-ref --verify --quiet refs/heads/site; then
git checkout site
else
git checkout -b site
fi
git config user.name "GitHub Action"
git config user.email "action@github.com"
# Step 7: Clean up existing files and replace with new ones
- name: Clean and Replace site contents
run: |
# Remove everything except the .git directory
find . -mindepth 1 ! -name '.git' ! -name '.gitignore' -exec rm -rf {} +
# Check if the 'site' directory has files and copy them
if [ -d "site" ] && [ "$(ls -A site)" ]; then
cp -r site/* ./ # Copy the contents from the 'site' directory to the root directory
else
echo "No files to copy from the 'site' directory."
fi
# Create the Google verification file
echo "google-site-verification: googlee5febdfb3cd460f8.html" > googlee5febdfb3cd460f8.html
# Step 8: Commit changes if there are any
- name: Commit changes
run: |
git status # Check current status
git add .
git diff-index --quiet HEAD || git commit -m "Update documentation"
# Step 9: Set up SSH for secure push
- 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
# Step 10: Push changes to the 'site' branch
- name: Push changes
run: |
git remote set-url origin git@github.com:ProdByGodfather/abarorm.git
git push origin site --force # Push changes to the 'site' branch