-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.05 KB
/
spaces-deploy.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
35
36
37
38
name: Deploy
on:
workflow_call:
secrets:
token:
description: 'A Hugging Face API token'
required: true
concurrency: ${{ github.job }}-${{ github.ref }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
show-progress: false
- 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.token }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
run: |
COMMIT_MESSAGE=$(git show -s --format=%s)
git clone https://$GITHUB_REPOSITORY_OWNER:[email protected]/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