-
Notifications
You must be signed in to change notification settings - Fork 18
34 lines (29 loc) · 967 Bytes
/
main.yml
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
name: Deploy
on:
push:
branches: [main]
paths:
- .github/workflows/main.yml
- Dockerfile
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Git config
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Push to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
run: |
COMMIT_MESSAGE=$(git show -s --format=%s)
git clone https://$GITHUB_REPOSITORY_OWNER:$HF_TOKEN@huggingface.co/spaces/$GITHUB_REPOSITORY_OWNER/$REPOSITORY_NAME
pushd $REPOSITORY_NAME
mv ../Dockerfile .
git add Dockerfile
git commit --amend -m "$COMMIT_MESSAGE"
git push --force-with-lease