annishjk01's picture
changes to deploy file
7003de8
name: MLaaS CI/CD Pipeline
on:
push:
branches:
- main # Runs this workflow when changes are pushed to the main branch
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo (Full Clone)
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fix shallow clone issue
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Dependencies
run: pip install -r api/requirement.txt
- name: Run Tests
run: pytest tests/test.py
# || echo "No tests found"
deploy:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git for Hugging Face
run: |
git config --global user.email "[email protected]"
git config --global user.name "annishjk01"
- name: Deploy to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }} # Use secure Hugging Face token
run: |
git remote add huggingface https://user:[email protected]/spaces/annishjk01/firstSpace || true
git fetch huggingface main || true # Fetch latest changes from HF (ignore errors)
git push --force huggingface main