Skip to content

Commit

Permalink
added workflow to sync, docs from repository as source of truth
Browse files Browse the repository at this point in the history
  • Loading branch information
sacha-roussakis-notter committed Feb 3, 2024
1 parent 10346d0 commit 13e73c1
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/sync-vaultify-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Sync to Azure DevOps

on:
push:
branches:
- main

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Repo
uses: actions/checkout@v2

- name: Configure Git
run: |
git config --global user.email "[email protected]"
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
if ! git clone https://[email protected]/buungroupmain/devops-blueprints/_git/vaultify-docs 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.md LICENSE.md || { 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 ../docs/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; }
# Commit and Push
git add .
git commit -m "Synced from GitHub"
if git status | grep -q "nothing to commit"; then
echo "No changes to sync"
else
if ! git push; then
echo "Failed to push changes to Azure DevOps. Exiting."
exit 1
fi
fi

0 comments on commit 13e73c1

Please sign in to comment.