Skip to content

Update update_space_2.yaml #88

Update update_space_2.yaml

Update update_space_2.yaml #88

name: Sync and Push to Hugging Face
on:
push:
branches:
- main # Trigger the workflow on push to the main branch
jobs:
sync-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
space_name: [company-pet-policy, about-mls, shakespeare] # List your Hugging Face space names here
steps:
- name: Checkout Source Repository
uses: actions/checkout@v2
with:
repository: david-oplatka/chatbot-streamlit
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print Source Directory Contents
run: |
ls -l
- name: Set up SSH for Hugging Face
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Configure SSH known hosts for Hugging Face
run: |
mkdir -p ~/.ssh
ssh-keyscan hf.co >> ~/.ssh/known_hosts
- name: Create Custom Temporary Directory for the space under RUNNER_TEMP
run: |
mkdir -p $RUNNER_TEMP/spaces/folder-${{ matrix.space_name }}
- name: Clone and Pull Target Hugging Face Repository
run: |
cd $RUNNER_TEMP/spaces/
git clone [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git
- name: Check Working directories
run: |
ls -lR $GITHUB_WORKSPACE
ls -lR $RUNNER_TEMP/spaces
- name: Sync Source Repository with Temporary Folder
run: |
pwd
rsync -av --exclude '.*' $GITHUB_WORKSPACE/* $RUNNER_TEMP/spaces/folder-${{ matrix.space_name }}/
git status
git add -A .
git commit -m "Sync updates from source repository" || echo "No changes to commit"
- name: Print Cloned Directory Contents After Sync
run: |
pwd
ls -lR $RUNNER_TEMP/spaces
- name: Push changes to Hugging Face Space
env:
HF_ACCESS_TOKEN: ${{ secrets.HF_TOKEN }} # Replace with your actual secret name
run: |
git push [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git