Spaces:
Sleeping
Sleeping
Commit ·
73e95ae
1
Parent(s): efc5bde
Workflow Test #3
Browse files
.github/workflows/ci.yml
CHANGED
|
@@ -73,9 +73,16 @@ jobs:
|
|
| 73 |
|
| 74 |
# Push to staging using authenticated remote
|
| 75 |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
|
|
|
| 76 |
git push origin staging
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
# Push to Hugging Face test space
|
|
|
|
| 79 |
git push --force \
|
| 80 |
https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME \
|
| 81 |
staging:main
|
|
|
|
|
|
| 73 |
|
| 74 |
# Push to staging using authenticated remote
|
| 75 |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
| 76 |
+
echo "Pushing to staging branch..."
|
| 77 |
git push origin staging
|
| 78 |
+
echo "Successfully pushed to staging. This should trigger the promote workflow."
|
| 79 |
+
|
| 80 |
+
# Wait a moment for the push to be processed
|
| 81 |
+
sleep 5
|
| 82 |
|
| 83 |
# Push to Hugging Face test space
|
| 84 |
+
echo "Pushing to Hugging Face test space..."
|
| 85 |
git push --force \
|
| 86 |
https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME \
|
| 87 |
staging:main
|
| 88 |
+
echo "Successfully pushed to Hugging Face test space."
|
.github/workflows/manual-promote.yml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Manual Promotion (Staging to Main)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
inputs:
|
| 6 |
+
reason:
|
| 7 |
+
description: 'Reason for manual promotion'
|
| 8 |
+
required: false
|
| 9 |
+
default: 'Manual promotion triggered'
|
| 10 |
+
|
| 11 |
+
permissions:
|
| 12 |
+
contents: write
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
manual-promote:
|
| 16 |
+
runs-on: ubuntu-latest
|
| 17 |
+
steps:
|
| 18 |
+
- name: Checkout staging
|
| 19 |
+
uses: actions/checkout@v4
|
| 20 |
+
with:
|
| 21 |
+
ref: staging
|
| 22 |
+
fetch-depth: 0
|
| 23 |
+
lfs: true
|
| 24 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 25 |
+
|
| 26 |
+
- name: Set up Python
|
| 27 |
+
uses: actions/setup-python@v5
|
| 28 |
+
with:
|
| 29 |
+
python-version: '3.11'
|
| 30 |
+
|
| 31 |
+
- name: Install dependencies
|
| 32 |
+
run: |
|
| 33 |
+
python -m pip install --upgrade pip
|
| 34 |
+
pip install -r requirements.txt
|
| 35 |
+
|
| 36 |
+
- name: Run tests on staging
|
| 37 |
+
env:
|
| 38 |
+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
|
| 39 |
+
run: pytest -v
|
| 40 |
+
|
| 41 |
+
- name: Promote staging to main
|
| 42 |
+
if: success()
|
| 43 |
+
env:
|
| 44 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 45 |
+
run: |
|
| 46 |
+
echo "Manual promotion reason: ${{ github.event.inputs.reason }}"
|
| 47 |
+
echo "Starting manual promotion from staging to main..."
|
| 48 |
+
|
| 49 |
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 50 |
+
git config --global user.name "github-actions[bot]"
|
| 51 |
+
git fetch origin
|
| 52 |
+
|
| 53 |
+
# Check if main branch exists remotely
|
| 54 |
+
if git show-ref --verify --quiet refs/remotes/origin/main; then
|
| 55 |
+
echo "Main branch exists, checking out and merging"
|
| 56 |
+
git checkout main
|
| 57 |
+
|
| 58 |
+
# Try to merge with strategy to resolve conflicts automatically
|
| 59 |
+
echo "Attempting to merge staging into main..."
|
| 60 |
+
if git merge staging --allow-unrelated-histories --no-ff -X theirs -m "Manual promote staging to main: ${{ github.event.inputs.reason }}"; then
|
| 61 |
+
echo "Merge successful"
|
| 62 |
+
else
|
| 63 |
+
echo "Merge conflicts detected, using staging version"
|
| 64 |
+
# Reset to staging state and create merge commit
|
| 65 |
+
git reset --hard staging
|
| 66 |
+
git commit --allow-empty -m "Manual promote staging to main (using staging version): ${{ github.event.inputs.reason }}"
|
| 67 |
+
fi
|
| 68 |
+
else
|
| 69 |
+
echo "Main branch doesn't exist, creating from staging"
|
| 70 |
+
git checkout -b main
|
| 71 |
+
fi
|
| 72 |
+
|
| 73 |
+
echo "Pushing to main branch..."
|
| 74 |
+
# Push to main using authenticated remote
|
| 75 |
+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
| 76 |
+
git push origin main
|
| 77 |
+
echo "Successfully promoted staging to main!"
|
.github/workflows/promote.yml
CHANGED
|
@@ -44,18 +44,21 @@ jobs:
|
|
| 44 |
env:
|
| 45 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 46 |
run: |
|
|
|
|
| 47 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 48 |
git config --global user.name "github-actions[bot]"
|
| 49 |
git fetch origin
|
| 50 |
git reset --hard
|
| 51 |
git clean -fdx
|
| 52 |
|
|
|
|
| 53 |
# Check if main branch exists remotely
|
| 54 |
if git show-ref --verify --quiet refs/remotes/origin/main; then
|
| 55 |
echo "Main branch exists, checking out and merging"
|
| 56 |
git checkout main
|
| 57 |
|
| 58 |
# Try to merge with strategy to resolve conflicts automatically
|
|
|
|
| 59 |
if git merge staging --allow-unrelated-histories --no-ff -X theirs -m "Auto-promote staging to main"; then
|
| 60 |
echo "Merge successful"
|
| 61 |
else
|
|
@@ -69,6 +72,8 @@ jobs:
|
|
| 69 |
git checkout -b main
|
| 70 |
fi
|
| 71 |
|
|
|
|
| 72 |
# Push to main using authenticated remote
|
| 73 |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
| 74 |
git push origin main
|
|
|
|
|
|
| 44 |
env:
|
| 45 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 46 |
run: |
|
| 47 |
+
echo "Starting promotion from staging to main..."
|
| 48 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 49 |
git config --global user.name "github-actions[bot]"
|
| 50 |
git fetch origin
|
| 51 |
git reset --hard
|
| 52 |
git clean -fdx
|
| 53 |
|
| 54 |
+
echo "Checking if main branch exists..."
|
| 55 |
# Check if main branch exists remotely
|
| 56 |
if git show-ref --verify --quiet refs/remotes/origin/main; then
|
| 57 |
echo "Main branch exists, checking out and merging"
|
| 58 |
git checkout main
|
| 59 |
|
| 60 |
# Try to merge with strategy to resolve conflicts automatically
|
| 61 |
+
echo "Attempting to merge staging into main..."
|
| 62 |
if git merge staging --allow-unrelated-histories --no-ff -X theirs -m "Auto-promote staging to main"; then
|
| 63 |
echo "Merge successful"
|
| 64 |
else
|
|
|
|
| 72 |
git checkout -b main
|
| 73 |
fi
|
| 74 |
|
| 75 |
+
echo "Pushing to main branch..."
|
| 76 |
# Push to main using authenticated remote
|
| 77 |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
| 78 |
git push origin main
|
| 79 |
+
echo "Successfully promoted staging to main!"
|