Skip to content

Merge pull request #56 from pkirilin/rework-folder-structure #29

Merge pull request #56 from pkirilin/rework-folder-structure

Merge pull request #56 from pkirilin/rework-folder-structure #29

Workflow file for this run

# 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: Deploy
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@v1
- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://index.docker.io/v1/
username: ${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}
password: ${{ secrets.AzureAppService_ContainerPassword_f7974bea4cb74acab7e80b5c884a8659 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}
file: ./Dockerfile
run-migrations:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.302
- name: Run migrator
run: dotnet run --configuration Release --project src/backend/FoodDiary.Migrator/FoodDiary.Migrator.csproj "${{ secrets.Migrator_DatabaseConnectionString }}"
deploy:
runs-on: ubuntu-latest
needs: run-migrations
environment:
name: 'production'
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: 'food-diary'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_d39bb6452cd540d78f4dd9fe3526ed62 }}
images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_6ff515138c474569b14fb663d02b6c5d }}/food-diary:${{ github.sha }}'