Skip to content

Deploy BOOP Web

Deploy BOOP Web #6

Workflow file for this run

name: Deploy BOOP Web
on:
push:
branches: [ main ]
workflow_dispatch:
# Allow manual triggering
jobs:
deploy-backend:
runs-on: ubuntu-latest
if: "contains(join(github.event.commits.*.modified, ' '), 'backend/') || github.event_name == 'workflow_dispatch'"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Hugging Face CLI
run: |
pip install huggingface_hub
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Login to Hugging Face
run: huggingface-cli login --token ${{ secrets.HF_TOKEN }}
- name: Clone Space Repository
run: git clone https://huggingface.co/spaces/${{ secrets.HF_USERNAME }}/BOOP-backend ./hf-space
- name: Copy Backend Files
run: |
cp -r Backend/* ./hf-space/
- name: Commit and Push to Hugging Face
run: |
cd ./hf-space
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git add .
git commit -m "Update backend from GitHub - ${{ github.sha }}"
git push https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ secrets.HF_USERNAME }}/BOOP-backend main
deploy-frontend:
runs-on: ubuntu-latest
if: "contains(join(github.event.commits.*.modified, ' '), 'frontend/') || github.event_name == 'workflow_dispatch'"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Deploy to Vercel
working-directory: ./frontend
run: |
vercel --token ${{ secrets.VERCEL_TOKEN }} \
--prod \
--yes \
--confirm \
-e REACT_APP_API_URL="https://${{ secrets.HF_USERNAME }}-boop-backend.hf.space"