diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..e77f9e757 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: Deploy to Azure Web App + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8' # Use the version your app requires + + - name: Restore dependencies + run: dotnet restore + + - name: Build project + run: dotnet build --configuration Release --no-restore + + - name: Publish project + run: dotnet publish -c Release -o ${{ github.workspace }}/publish + + - name: Login to Azure Web App + uses: azure/login@v2 + with: + client-id: ${{ 26379a30-523d-499b-ac56-582060bd8e56 }} + tenant-id: ${{ 81fcffd2-b4fc-4511-812b-a48b02631e81 }} + subscription-id: ${{ b7126c40-a209-4e7f-af20-a04162681c4c }} + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: cloud-apps01 + package: ${{ github.workspace }}/publish