Spaces:
Sleeping
Sleeping
name: Deploy to Hugging Face Space | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.6 | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir -r requirements.txt | |
- name: Configure Git User | |
run: | | |
git config --global user.name "Fahad Khan" | |
git config --global user.email "[email protected]" | |
# Step 4: Authenticate Hugging Face CLI | |
- name: Authenticate Hugging Face CLI | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: huggingface-cli login --token $HF_TOKEN | |
# Step 5: Push application files to Hugging Face Spac | |
- name: Push Files to Hugging Face Space | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: | | |
git pull --rebase https://fahd9999:[email protected]/spaces/fahd9999/resultprediction main || echo "No updates to pull" | |
git checkout --theirs .github/workflows/main.yml || echo "No conflicts to resolve" | |
git add .github/workflows/main.yml || echo "No conflicts to resolve" | |
git rebase --continue || echo "Rebase completed" | |
git push https://fahd9999:[email protected]/spaces/fahd9999/resultprediction main |