Skip to content

Update main_fefezfezf.yml #15

Update main_fefezfezf.yml

Update main_fefezfezf.yml #15

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Docker App (good fefezfezf )
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: https://index.docker.io/v1/
username: ${{ secrets.AzureAppService_ContainerUsername_007dc16c00194a579ee0e182f3912414 }}
password: ${{ secrets.AzureAppService_ContainerPassword_03b591a7c15d426aa4439cb5a79e30b8 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: forsanta/webapi-starter-dotnet8:${{ github.sha }}
file: ./Dockerfile
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
outputs:
webapp-url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'fefezfezf'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_9b585dbfa0374924ab161fec5b2dea00 }}
images: 'forsanta/webapi-starter-dotnet8:${{ github.sha }}'
check-url:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Vérifier que l’URL retourne "Hello World"
run: |
url="${{ needs.deploy.outputs.webapp-url }}"
echo "Test de l'URL : $url"
response=$(curl -s "$url")
echo "Réponse : $response"
if [ "$response" != "Hello World!" ]; then
echo "❌ L'URL ne retourne pas 'Hello World!'"
exit 1
fi
echo "✅ L'URL retourne bien 'Hello World!'"