Skip to content

Merge pull request #28 from Imaging-Plaza/update-hf-deploy #1

Merge pull request #28 from Imaging-Plaza/update-hf-deploy

Merge pull request #28 from Imaging-Plaza/update-hf-deploy #1

Workflow file for this run

name: Deploy main to Hugging Face Space (SDSC/ai-agent)
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
# Remove assets so they are not pushed to HF
- name: Remove assets folder for HF push
run: |
rm -rf assets
git rm -r --cached assets || true
# 👇 This step ONLY changes README in the CI workspace, not in your repo
- name: Generate Hugging Face README with YAML frontmatter
run: |
# Keep original README content
mv README.md README.project.md
# Create new README with HF config at the top
cat << 'EOF' > README.md
---
title: AI Agent
emoji: 🤖
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
---
EOF
# Append the original README content below the YAML block
cat README.project.md >> README.md
# Commit this *locally* so we can push it to the HF remote
git config user.email "ci@github.actions"
git config user.name "github-actions[bot]"
git add README.md
git commit -m "Add HF Spaces frontmatter to README for deployment" || echo "No changes to commit"
- name: Push main to HF Space SDSC/ai-agent
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# Push the current branch (main, with the local README commit) to the Space's main
git push --force \
https://SDSC:${HF_TOKEN}@huggingface.co/spaces/SDSC/ai-agent \
HEAD:main