-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 2.16 KB
/
Copy pathdeploy.yml
File metadata and controls
62 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
name: Deploy BOOP Web
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
deploy-backend:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure git and clone Space
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git clone https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ secrets.HF_USERNAME }}/BOOP-backend ./hf-space
- name: Sync Backend files into Space
run: |
rsync -a --delete --exclude=.git --exclude=venv --exclude=__pycache__ --exclude=.DS_Store --exclude=uploads --exclude=outputs Backend/ ./hf-space/
cp .github/HF_README.md ./hf-space/README.md
cp .github/HF_gitattributes ./hf-space/.gitattributes
- name: Commit and push to Hugging Face
run: |
cd ./hf-space
git add -A
if git diff --cached --quiet; then
echo "No changes to deploy"
exit 0
fi
git commit -m "Update backend from GitHub - ${{ github.sha }}"
git pull --rebase origin main
git push origin main
# deploy-frontend:
# runs-on: ubuntu-latest
# if: "contains(join(github.event.commits.*.modified, ' '), 'frontend/') || contains(join(github.event.commits.*.added, ' '), 'frontend/') || contains(join(github.event.commits.*.removed, ' '), 'frontend/') || github.event_name == 'workflow_dispatch'"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '18'
#
# - 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"