Archisman Karmakar
Update deploy_to_HF_space.yml
3bc6b36 unverified
raw
history blame
2.82 kB
name: Deploy to Hugging Face Spaces
permissions:
contents: read
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy-to-hf:
# permissions:
# pull-requests: write
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
# Install from requirements.txt if available
# if [ -f requirements.txt ]; then
# echo "Installing from requirements.txt"
# pip install -r requirements.txt
# fi
# Optionally install the package using pyproject.toml if needed
# if [ -f pyproject.toml ]; then
# echo "Installing package via pyproject.toml"
# pip install .
# fi
- 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
# run: huggingface-cli repo clone \
# YOUR_HF_USERNAME/SPACE_NAME \
# --token "${{ secrets.HF_READ_WRITE_TOKEN }}" \
# --branch main \
# hf-space
- 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
- name: Copy repository files to HF Space
run: |
# Remove the .git folder so we can reinitialize a clean git repository
rm -rf hf-space/.git
cp -R . 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!"