Re-adding automations for OVOS Docker compose files.
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
name: Sync Compose Directory
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# Runs at 2:00 UTC every day; adjust as needed
|
||||||
|
- cron: "0 2 * * *"
|
||||||
|
workflow_dispatch: # allows manual trigger
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-compose:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Step 1: Checkout the repo
|
||||||
|
- name: Checkout benedikta-ovos
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Sync compose from ovos-docker
|
||||||
|
run: |
|
||||||
|
# Make the sync script executable
|
||||||
|
chmod +x ./update-sync-ovos-compose.sh
|
||||||
|
# Run the script
|
||||||
|
./update-sync-ovos-compose.sh
|
||||||
|
|
||||||
|
- name: Commit & push changes
|
||||||
|
uses: EndBug/add-and-commit@v9
|
||||||
|
with:
|
||||||
|
add: "compose"
|
||||||
|
message: "Update compose/ from ovos-docker:dev"
|
||||||
|
push: true
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Config
|
||||||
|
OVOS_DOCKER_DIR="../ovos-docker"
|
||||||
|
OVOS_REMOTE="ovos-docker-local"
|
||||||
|
SPLIT_BRANCH="ovos-compose-split"
|
||||||
|
PREFIX="ovos-compose"
|
||||||
|
|
||||||
|
# Clone ovos-docker if missing
|
||||||
|
if [ ! -d "$OVOS_DOCKER_DIR/.git" ]; then
|
||||||
|
echo "Cloning ovos-docker..."
|
||||||
|
git clone https://github.com/OpenVoiceOS/ovos-docker.git "$OVOS_DOCKER_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update ovos-docker
|
||||||
|
echo "Updating ovos-docker..."
|
||||||
|
cd "$OVOS_DOCKER_DIR"
|
||||||
|
git fetch origin
|
||||||
|
git checkout dev
|
||||||
|
git pull origin dev
|
||||||
|
|
||||||
|
# Create split branch
|
||||||
|
echo "Splitting ovos-compose/ directory..."
|
||||||
|
git branch -D "$SPLIT_BRANCH" 2>/dev/null || true
|
||||||
|
git subtree split --prefix=$PREFIX origin/dev -b "$SPLIT_BRANCH"
|
||||||
|
|
||||||
|
# Go back to benedikta-ovos
|
||||||
|
cd - >/dev/null
|
||||||
|
|
||||||
|
# Add remote if not exists
|
||||||
|
if ! git remote | grep -q "$OVOS_REMOTE"; then
|
||||||
|
git remote add "$OVOS_REMOTE" "$OVOS_DOCKER_DIR"
|
||||||
|
fi
|
||||||
|
git fetch "$OVOS_REMOTE"
|
||||||
|
|
||||||
|
# Check if ovos-compose/ already exists in benedikta-ovos
|
||||||
|
if [ ! -d "$PREFIX" ]; then
|
||||||
|
echo "Adding ovos-compose/ for the first time..."
|
||||||
|
git subtree add --prefix=$PREFIX "$OVOS_REMOTE" "$SPLIT_BRANCH" --squash
|
||||||
|
else
|
||||||
|
echo "Updating existing ovos-compose/ directory..."
|
||||||
|
git subtree pull --prefix=$PREFIX "$OVOS_REMOTE" "$SPLIT_BRANCH" --squash
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ ovos-compose/ is synced with ovos-docker:dev"
|
||||||
Reference in New Issue
Block a user