Skip to content

added workflow to sync, docs from repository as source of truth #9

added workflow to sync, docs from repository as source of truth

added workflow to sync, docs from repository as source of truth #9

name: Sync to Azure DevOps
on:
push:
branches:
- main
paths:
- '**/*.md' # Run workflow for any markdown file changes in the repo
- 'LICENSE' # Run workflow for changes to the LICENSE file in the root
- 'docs/cli/**' # Run workflow for any changes in the /docs/cli directory
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Repo
uses: actions/checkout@v2
- name: Configure Git
run: |
git config --global user.email "vaultify@buungroup.com"
git config --global user.name "vaultify_automation"
- name: Sync to Azure DevOps
env:
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
run: |
# Clone Azure DevOps Repo
echo "Cloning the Azure DevOps repository..."
PAT=${{ secrets.AZURE_DEVOPS_PAT }}
REPO_URL=${{ secrets.VAULTIFY_DOCS_REPO_URL }}
# Construct the URL with the PAT
CLONE_URL="https://$PAT@$REPO_URL"
# Clone the repository using the constructed URL
if ! git clone "$CLONE_URL" vaultify-docs; then
echo "Failed to clone Azure DevOps repository. Exiting."
exit 1
fi
cd vaultify-docs || exit
# Sync root level documentation
cp ../README.md README.md || { echo "Failed to copy README.md"; exit 1; }
cp ../CHANGELOG.md CHANGELOG.md || { echo "Failed to copy CHANGELOG.md"; exit 1; }
cp ../LICENSE LICENSE || { echo "Failed to copy LICENSE.md"; exit 1; }
# Ensure the docs directory exists
mkdir -p docs/cli
# Sync specific documentation within docs
cp ../docs/CLI.md docs/CLI.md || { echo "Failed to copy CLI.md"; exit 1; }
cp ../CONTRIBUTING.md docs/CONTRIBUTING.md || { echo "Failed to copy CONTRIBUTING.md"; exit 1; }
# Sync cli directory
rm -rf docs/cli/* || { echo "Failed to clear docs/cli directory"; exit 1; }
cp -R ../docs/cli/* docs/cli/ || { echo "Failed to copy cli directory"; exit 1; }
git add .
git commit -m "Synced from GitHub"
git push origin main