hbofficial-1005
Updated Gradio App
68f05a6
name: CI/CD Pipeline
on:
push:
branches:
- "feature/**"
- develop
- main
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Run Tests
run: python -m unittest discover -s tests
merge-to-develop:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/feature/')
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git authentication
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
- name: Ensure develop branch exists
run: |
git fetch origin
if git show-ref --verify --quiet refs/remotes/origin/develop; then
echo "Develop branch exists."
else
echo "Creating develop branch."
git checkout -b develop
git push origin develop
fi
- name: Merge feature branch to develop
run: |
git fetch origin
git checkout develop
git merge --no-ff origin/${GITHUB_REF#refs/heads/}
git push origin develop
merge-to-main:
needs: merge-to-develop
runs-on: ubuntu-latest
if: success()
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git authentication
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
- name: Merge develop branch to main
run: |
git fetch origin
git checkout main
git merge --no-ff origin/develop
git push origin main
finalize-deployment:
needs: merge-to-main
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git authentication
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
- name: Sync Develop with Main
run: |
git fetch origin
git checkout develop
git merge --no-ff origin/main
git push origin develop