Archisman Karmakar
Update deploy_to_HF_space.yml
d434f9c
raw
history blame
8.22 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
uses: actions/checkout@v3
with:
fetch-depth: 0
# - name: Set up Python
# 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
# USE THIS IF YOU WANT TO AVOID DOCKER
# - name: Rename Poetry files to ingore
# run: |
# mv pyproject.toml pyproject.toml.ignore
# mv poetry.lock poetry.lock.ignore
# - name: Upgrade pip
# run: python -m pip install --upgrade pip
# - name: Install & configure Poetry
# run: |
# # - name: Disable Poetry virtualenv creation
# curl -sSL https://install.python-poetry.org | python3 -
# echo "$HOME/.local/bin" >> $GITHUB_PATH
# # pip install --upgrade poetry --upgrade-strategy eager
# poetry config virtualenvs.create false
# poetry --version
# poetry add poetry-plugin-export
# poetry self add poetry-plugin-export
# - name: Install dependencies
# run: |
# # pip install poetry
# # pip install --upgrade poetry --upgrade-strategy eager
# poetry --version
# # poetry install --no-root
# poetry export -f requirements.txt --without-hashes --output requirements.txt
# pip install -r requirements.txt
# # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - name: Rename Poetry files to original
# run: |
# mv pyproject.toml.ignore pyproject.toml
# mv poetry.lock.ignore poetry.lock
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Push to Hugging Face Space
env:
HF_READ_WRITE_TOKEN: ${{ secrets.HF_READ_WRITE_TOKEN }}
run: |
git remote add space https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
git push --force https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_READ_WRITE_TOKEN }}@huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
# name: Deploy to Hugging Face Spaces
# permissions:
# contents: write # Adjusted to allow pushing changes
# 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 "[email protected]"
# git config --global user.name "GitHub Actions"
# - name: Clone Hugging Face Space repository
# run: |
# git clone https://HF_USERNAME:${{ secrets.HF_READ_WRITE_TOKEN }}@huggingface.co/spaces/tachygraphy-microtext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder hf-space
# - name: Copy repository files to HF Space
# run: |
# # 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
# # Initialize Git repository if .git doesn't exist
# if [ ! -d ".git" ]; then
# git init
# git remote add origin https://huggingface.co/spaces/tachygraphy-microtext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
# fi
# # Check if 'main' branch exists
# if git show-ref --verify --quiet refs/heads/main; then
# git checkout main
# else
# git checkout -b main
# fi
# git add .
# git commit -m "Update deployment via GitHub Actions"
# git push -f origin main
# echo "Deployment to Hugging Face Spaces completed!"
# 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 "[email protected]"
# 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!"