Spaces:
Sleeping
Sleeping
dani-ange
commited on
Update train-deploy.yaml
Browse files
.github/workflows/train-deploy.yaml
CHANGED
@@ -15,12 +15,28 @@ jobs:
|
|
15 |
- name: Checkout repository
|
16 |
uses: actions/checkout@v3
|
17 |
with:
|
18 |
-
fetch-depth: 0 #
|
19 |
|
20 |
-
- name: Set up
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
- name: Install dependencies
|
26 |
run: pip install -r requirements.txt
|
@@ -32,26 +48,11 @@ jobs:
|
|
32 |
run: |
|
33 |
huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
|
34 |
|
35 |
-
- name: Merge PR changes into master
|
36 |
-
run: |
|
37 |
-
git config --global user.email "[email protected]"
|
38 |
-
git config --global user.name "dani-ange"
|
39 |
-
|
40 |
-
git checkout master # Switch to master branch
|
41 |
-
git pull origin master # Ensure latest changes
|
42 |
-
|
43 |
-
# Merge PR changes from the pull request branch
|
44 |
-
git merge --no-ff ${{ github.head_ref }} -m "Merging PR changes from ${{ github.head_ref }}"
|
45 |
-
|
46 |
-
git push origin master # Push merged changes to master
|
47 |
-
|
48 |
- name: Deploy to Hugging Face
|
49 |
env:
|
50 |
HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
|
51 |
run: |
|
52 |
huggingface-cli login --token $HF_TOKEN
|
53 |
-
git config --global user.email "[email protected]"
|
54 |
-
git config --global user.name "dani-ange"
|
55 |
|
56 |
if git diff --quiet; then
|
57 |
echo "No changes to commit."
|
|
|
15 |
- name: Checkout repository
|
16 |
uses: actions/checkout@v3
|
17 |
with:
|
18 |
+
fetch-depth: 0 # Fetch all branches
|
19 |
|
20 |
+
- name: Set up Git
|
21 |
+
run: |
|
22 |
+
git config --global user.email "[email protected]"
|
23 |
+
git config --global user.name "dani-ange"
|
24 |
+
|
25 |
+
- name: Ensure master branch is up-to-date
|
26 |
+
run: |
|
27 |
+
git checkout master # Ensure we're on master
|
28 |
+
git pull origin master # Get latest changes
|
29 |
+
|
30 |
+
- name: Merge PR changes into master
|
31 |
+
run: |
|
32 |
+
# Ensure the PR branch is properly merged
|
33 |
+
if git branch -r | grep "origin/${{ github.head_ref }}"; then
|
34 |
+
git merge --no-ff origin/${{ github.head_ref }} -m "Merging PR changes from ${{ github.head_ref }}"
|
35 |
+
git push origin master # Push merged changes
|
36 |
+
else
|
37 |
+
echo "Error: Branch ${{ github.head_ref }} does not exist in remote."
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
|
41 |
- name: Install dependencies
|
42 |
run: pip install -r requirements.txt
|
|
|
48 |
run: |
|
49 |
huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
- name: Deploy to Hugging Face
|
52 |
env:
|
53 |
HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
|
54 |
run: |
|
55 |
huggingface-cli login --token $HF_TOKEN
|
|
|
|
|
56 |
|
57 |
if git diff --quiet; then
|
58 |
echo "No changes to commit."
|