Archisman Karmakar commited on
Commit
48fa496
·
unverified ·
1 Parent(s): f121162

Update deploy_to_HF_space.yml

Browse files
.github/workflows/deploy_to_HF_space.yml CHANGED
@@ -13,73 +13,201 @@ jobs:
13
  runs-on: ubuntu-latest
14
 
15
  steps:
16
- - name: Check out repository with LFS support
17
  uses: actions/checkout@v3
18
  with:
19
  fetch-depth: 0
20
- lfs: true
21
 
22
- - name: Set up Python 3.12
23
  uses: actions/setup-python@v4
24
  with:
25
- python-version: "3.12"
26
-
27
- - name: Environment Setup & Install system packages from packages.txt
28
- run: |
29
- sudo add-apt-repository universe
30
- sudo apt-get update
31
- sudo xargs -a packages.txt apt-get install -y
32
-
33
- - name: Upgrade pip
34
- run: python -m pip install --upgrade pip
35
 
36
  - name: Install dependencies
37
  run: |
38
- echo "Python version:"
39
- python --version
40
 
41
- pip install -r requirements.txt
42
-
43
- - name: Install Hugging Face CLI
44
- run: pip install huggingface_hub
45
 
46
  - name: Configure Git
47
  run: |
48
  git config --global user.email "[email protected]"
49
  git config --global user.name "GitHub Actions"
50
 
51
- - name: Clone Hugging Face Space repository
 
 
52
  run: |
53
- git clone https://HF_USERNAME:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder hf-space
 
54
 
55
- - name: Copy repository files to HF Space
56
- run: |
57
- # Remove the .git folder from the cloned HF Space repository
58
- rm -rf hf-space/.git
59
- # Use rsync to copy all files except the hf-space directory to avoid copying the clone into itself
60
- rsync -av --exclude='hf-space' ./ hf-space/
61
-
62
- # - name: Commit and push to Hugging Face
63
- # run: |
64
- # cd hf-space
65
- # git init
66
- # git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
67
- # git checkout -b main
68
- # git add .
69
- # git commit -m "Update deployment via GitHub Actions"
70
- # git push -f origin main
71
- # echo "Deployment to Hugging Face Spaces completed!"
72
-
73
- - name: Commit and push to Hugging Face
74
- run: |
75
- cd hf-space
76
- git init
77
- # Remove existing origin if it exists
78
- git remote remove origin || true
79
- git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
80
- git checkout -b main
81
- git add .
82
- git commit -m "Update deployment via GitHub Actions"
83
- git push -f origin main
84
- echo "Deployment to Hugging Face Spaces completed!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
 
13
  runs-on: ubuntu-latest
14
 
15
  steps:
16
+ - name: Check out repository
17
  uses: actions/checkout@v3
18
  with:
19
  fetch-depth: 0
 
20
 
21
+ - name: Set up Python
22
  uses: actions/setup-python@v4
23
  with:
24
+ python-version: '3.12'
 
 
 
 
 
 
 
 
 
25
 
26
  - name: Install dependencies
27
  run: |
28
+ python -m pip install --upgrade pip
 
29
 
30
+ pip install poetry
31
+ poetry install
32
+
33
+ # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34
 
35
  - name: Configure Git
36
  run: |
37
  git config --global user.email "[email protected]"
38
  git config --global user.name "GitHub Actions"
39
 
40
+ - name: Push to Hugging Face Space
41
+ env:
42
+ HF_READ_WRITE_TOKEN: ${{ secrets.HF_READ_WRITE_TOKEN }}
43
  run: |
44
+ git remote add space https://huggingface.co/spaces/YOUR_HF_USERNAME/SPACE_NAME
45
+ git push --force https://HF_USERNAME:${{ secrets.HF_READ_WRITE_TOKEN }}@huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
46
 
47
+
48
+
49
+
50
+ # name: Deploy to Hugging Face Spaces
51
+ # permissions:
52
+ # contents: write # Adjusted to allow pushing changes
53
+
54
+ # on:
55
+ # push:
56
+ # branches:
57
+ # - main
58
+ # workflow_dispatch:
59
+
60
+ # jobs:
61
+ # deploy-to-hf:
62
+ # runs-on: ubuntu-latest
63
+
64
+ # steps:
65
+ # - name: Check out repository with LFS support
66
+ # uses: actions/checkout@v3
67
+ # with:
68
+ # fetch-depth: 0
69
+ # lfs: true
70
+
71
+ # - name: Set up Python 3.12
72
+ # uses: actions/setup-python@v4
73
+ # with:
74
+ # python-version: "3.12"
75
+
76
+ # - name: Environment Setup & Install system packages from packages.txt
77
+ # run: |
78
+ # sudo add-apt-repository universe
79
+ # sudo apt-get update
80
+ # sudo xargs -a packages.txt apt-get install -y
81
+
82
+ # - name: Upgrade pip
83
+ # run: python -m pip install --upgrade pip
84
+
85
+ # - name: Install dependencies
86
+ # run: |
87
+ # echo "Python version:"
88
+ # python --version
89
+ # pip install -r requirements.txt
90
+
91
+ # - name: Install Hugging Face CLI
92
+ # run: pip install huggingface_hub
93
+
94
+ # - name: Configure Git
95
+ # run: |
96
+ # git config --global user.email "[email protected]"
97
+ # git config --global user.name "GitHub Actions"
98
+
99
+ # - name: Clone Hugging Face Space repository
100
+ # run: |
101
+ # git clone https://HF_USERNAME:${{ secrets.HF_READ_WRITE_TOKEN }}@huggingface.co/spaces/tachygraphy-microtext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder hf-space
102
+
103
+ # - name: Copy repository files to HF Space
104
+ # run: |
105
+ # # Use rsync to copy all files except the hf-space directory to avoid copying the clone into itself
106
+ # rsync -av --exclude='hf-space' ./ hf-space/
107
+
108
+ # - name: Commit and push to Hugging Face
109
+ # run: |
110
+ # cd hf-space
111
+ # # Initialize Git repository if .git doesn't exist
112
+ # if [ ! -d ".git" ]; then
113
+ # git init
114
+ # git remote add origin https://huggingface.co/spaces/tachygraphy-microtext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
115
+ # fi
116
+ # # Check if 'main' branch exists
117
+ # if git show-ref --verify --quiet refs/heads/main; then
118
+ # git checkout main
119
+ # else
120
+ # git checkout -b main
121
+ # fi
122
+ # git add .
123
+ # git commit -m "Update deployment via GitHub Actions"
124
+ # git push -f origin main
125
+ # echo "Deployment to Hugging Face Spaces completed!"
126
+
127
+
128
+
129
+ # name: Deploy to Hugging Face Spaces
130
+ # permissions:
131
+ # contents: read
132
+
133
+ # on:
134
+ # push:
135
+ # branches:
136
+ # - main
137
+ # workflow_dispatch:
138
+
139
+ # jobs:
140
+ # deploy-to-hf:
141
+ # runs-on: ubuntu-latest
142
+
143
+ # steps:
144
+ # - name: Check out repository with LFS support
145
+ # uses: actions/checkout@v3
146
+ # with:
147
+ # fetch-depth: 0
148
+ # lfs: true
149
+
150
+ # - name: Set up Python 3.12
151
+ # uses: actions/setup-python@v4
152
+ # with:
153
+ # python-version: "3.12"
154
+
155
+ # - name: Environment Setup & Install system packages from packages.txt
156
+ # run: |
157
+ # sudo add-apt-repository universe
158
+ # sudo apt-get update
159
+ # sudo xargs -a packages.txt apt-get install -y
160
+
161
+ # - name: Upgrade pip
162
+ # run: python -m pip install --upgrade pip
163
+
164
+ # - name: Install dependencies
165
+ # run: |
166
+ # echo "Python version:"
167
+ # python --version
168
+
169
+ # pip install -r requirements.txt
170
+
171
+ # - name: Install Hugging Face CLI
172
+ # run: pip install huggingface_hub
173
+
174
+ # - name: Configure Git
175
+ # run: |
176
+ # git config --global user.email "[email protected]"
177
+ # git config --global user.name "GitHub Actions"
178
+
179
+ # - name: Clone Hugging Face Space repository
180
+ # run: |
181
+ # git clone https://HF_USERNAME:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder hf-space
182
+
183
+ # - name: Copy repository files to HF Space
184
+ # run: |
185
+ # # Remove the .git folder from the cloned HF Space repository
186
+ # rm -rf hf-space/.git
187
+ # # Use rsync to copy all files except the hf-space directory to avoid copying the clone into itself
188
+ # rsync -av --exclude='hf-space' ./ hf-space/
189
+
190
+ # # - name: Commit and push to Hugging Face
191
+ # # run: |
192
+ # # cd hf-space
193
+ # # git init
194
+ # # git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
195
+ # # git checkout -b main
196
+ # # git add .
197
+ # # git commit -m "Update deployment via GitHub Actions"
198
+ # # git push -f origin main
199
+ # # echo "Deployment to Hugging Face Spaces completed!"
200
+
201
+ # - name: Commit and push to Hugging Face
202
+ # run: |
203
+ # cd hf-space
204
+ # git init
205
+ # # Remove existing origin if it exists
206
+ # git remote remove origin || true
207
+ # git remote add origin https://huggingface.co/spaces/tachygraphy-microtrext-norm-org/Tachygraphy-Microtext-Analysis-and-Normalization-ArchismanCoder
208
+ # git checkout -b main
209
+ # git add .
210
+ # git commit -m "Update deployment via GitHub Actions"
211
+ # git push -f origin main
212
+ # echo "Deployment to Hugging Face Spaces completed!"
213