Archisman Karmakar
Update deploy_to_HF_space.yml
f121162 unverified
raw
history blame
2.79 kB
name: Deploy to Hugging Face Spaces
permissions:
contents: read
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy-to-hf:
runs-on: ubuntu-latest
steps:
- name: Check out repository with LFS support
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Environment Setup & Install system packages from packages.txt
run: |
sudo add-apt-repository universe
sudo apt-get update
sudo xargs -a packages.txt apt-get install -y
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
echo "Python version:"
python --version
pip install -r requirements.txt
- name: Install Hugging Face CLI
run: pip install huggingface_hub
- name: Configure Git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: Clone Hugging Face Space repository
run: |
git clone https://HF_USERNAME:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder hf-space
- name: Copy repository files to HF Space
run: |
# Remove the .git folder from the cloned HF Space repository
rm -rf hf-space/.git
# Use rsync to copy all files except the hf-space directory to avoid copying the clone into itself
rsync -av --exclude='hf-space' ./ hf-space/
# - name: Commit and push to Hugging Face
# run: |
# cd hf-space
# git init
# git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
# git checkout -b main
# git add .
# git commit -m "Update deployment via GitHub Actions"
# git push -f origin main
# echo "Deployment to Hugging Face Spaces completed!"
- name: Commit and push to Hugging Face
run: |
cd hf-space
git init
# Remove existing origin if it exists
git remote remove origin || true
git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
git checkout -b main
git add .
git commit -m "Update deployment via GitHub Actions"
git push -f origin main
echo "Deployment to Hugging Face Spaces completed!"