File size: 1,627 Bytes
fe1089d
c28c597
 
 
fe1089d
 
 
 
 
 
 
 
 
c28c597
 
 
fe1089d
 
c28c597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fe1089d
 
 
 
 
 
 
 
 
 
 
 
 
 
7b73dfd
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
# workflow that syncs the main branch to the Hugging Face Hub (Huggingface Spaces)
# only syncs if the build and lint is also fine
# CREDIT: Adapted from Hugging Face, Inc.
## see https://huggingface.co/docs/hub/spaces-github-actions

name: HGF Hub Sync (Main)
# runs on pushes to the main branch and manually triggered workflows
on:
  push:
    branches: [main]

  workflow_dispatch:

permissions:
  contents: read

# jobs to run
jobs:
  
  # build job that installs dependencies and lints
  build:
    runs-on: ubuntu-latest
    steps:
    # checkout the repository
    - uses: actions/checkout@v3
    # set up python 3.10
    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
    # install dependencies from requirements.txt
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint black
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    # lint and format all files with black (as defined in pyproject.toml)
    - name: Lint & Fix with Black
      run: black .
    # lint with pylint
    - name: Lint with Pylint
      run: pylint .
  # sync job
  sync-to-hub:
    runs-on: ubuntu-latest
    steps:
    # checkout the repository
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          lfs: true
      # push to hub with huggingface token
      - name: Push to hub
        env:
          HF_TOKEN: ${{ secrets.HF_TOKEN }}
        # run git push
        run: git push https://LennardZuendorf:$HF_TOKEN@huggingface.co/spaces/LennardZuendorf/thesis main