-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (56 loc) · 2.16 KB
/
Copy pathdeploy.yml
File metadata and controls
68 lines (56 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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"