M. Rifqi Akram commited on
Commit
d8c9dc0
β€’
1 Parent(s): dfa0bdd

Update main.yml

Browse files
Files changed (1) hide show
  1. .github/workflows/main.yml +6 -34
.github/workflows/main.yml CHANGED
@@ -1,5 +1,4 @@
1
- name: Sync to Hugging Face space
2
-
3
  on:
4
  push:
5
  branches: [main]
@@ -8,41 +7,14 @@ on:
8
  workflow_dispatch:
9
 
10
  jobs:
11
- sync-to-space:
12
  runs-on: ubuntu-latest
13
  steps:
14
- - uses: actions/checkout@v2
15
  with:
16
  fetch-depth: 0
17
- - name: Push to space
 
18
  env:
19
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
- HF_USERNAME: YOUR_HF_USERNAME # m3hrdadfi
21
- HF_SPACE: YOUR_HF_SPACE_REPO # huggingface.co/spaces/flax-community/chef-transformer
22
- TARGET_BRANCH: main
23
- GIT_USER_EMAIL: GIT_USER_EMAIL
24
- GIT_USER_NAME: GIT_USER_NAME
25
- run: |
26
- echo "Cloning destination git repository"
27
- git config --global user.email "$GIT_USER_EMAIL"
28
- git config --global user.name "$GIT_USER_NAME"
29
- CLONE_DIR=$(mktemp -d)
30
- git clone "https://$HF_USERNAME:$HF_TOKEN@$HF_SPACE" "$CLONE_DIR"
31
- ls -la "$CLONE_DIR"
32
- echo "Copy contents to clone git repository"
33
- cp -rf * "$CLONE_DIR"
34
- COMMIT_MESSAGE=$(git log --oneline --format=%B -n 1 HEAD | head -n 1)
35
- COMM=${COMM:=Sync with Github}
36
- echo "commit message:"
37
- echo "$COMMIT_MESSAGE"
38
- cd "$CLONE_DIR"
39
- echo "Files that will be pushed:"
40
- ls -la
41
- echo "git add:"
42
- git add -A
43
- echo "git status:"
44
- git status
45
- echo "git diff-index:"
46
- git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE"
47
- echo "git push origin:"
48
- git push "https://$HF_USERNAME:$HF_TOKEN@$HF_SPACE" "$TARGET_BRANCH"
 
1
+ name: Sync to Hugging Face hub
 
2
  on:
3
  push:
4
  branches: [main]
 
7
  workflow_dispatch:
8
 
9
  jobs:
10
+ sync-to-hub:
11
  runs-on: ubuntu-latest
12
  steps:
13
+ - uses: actions/checkout@v3
14
  with:
15
  fetch-depth: 0
16
+ lfs: true
17
+ - name: Push to hub
18
  env:
19
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push https://rifqiakram:$HF_TOKEN@huggingface.co/spaces/rifqiakram/jankenpon main