Update update_space_2.yaml #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- 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: Clone and Pull Target Hugging Face Repository | |
run: | | |
git clone [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git $RUNNER_TEMP/spaces/${{ matrix.space_name }} | |
- name: Check Working directories | |
run: | | |
ls -lR /home/runner/work/ | |
- name: Sync Source Repository with Temporary Folder | |
run: | | |
pwd | |
ls -lR $GITHUB_WORKSPACE | |
rsync -av --exclude '.*' $GITHUB_WORKSPACE/ $RUNNER_TEMP/spaces/${{ matrix.space_name }}/ | |
- name: commit changes | |
run: | | |
cd $RUNNER_TEMP/spaces/${{ matrix.space_name }} | |
pwd | |
sed -i 's/title: "Enter Chatbot Title"/title: "My Title"/g' README.md | |
ls -lR | |
echo "git status" | |
pwd | |
git status | |
echo "git add" | |
pwd | |
git add . | |
echo "git commit" | |
pwd | |
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 |