correção conflito git pull #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run HTTP server and verify | |
run: | | |
python -m http.server 8000 & | |
# Give the server time to start | |
for i in {1..10}; do | |
if curl -s http://localhost:8000/index.html > /dev/null; then | |
echo "Server is up and running." | |
break | |
else | |
echo "Waiting for server to start..." | |
sleep 1 | |
fi | |
done | |
# Fetch the page | |
curl -I http://localhost:8000/index.html | |
- name: Set up Git for deployment | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
- name: Deploy changes | |
run: | | |
git fetch origin | |
git checkout -b projeto_deploy || git checkout projeto_deploy | |
git pull origin projeto_deploy | |
git add . | |
git commit -m "Deploy changes to projeto_deploy branch" || echo "No changes to commit" | |
git push origin projeto_deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |