Skip to content

Dev/tahir/apis centralized control (#1565) #722

Dev/tahir/apis centralized control (#1565)

Dev/tahir/apis centralized control (#1565) #722

# 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: TrashMobDev - Website
on:
push:
branches:
- main
paths:
- '.github/**'
- 'TrashMob/**'
- 'TrashMob.Models/**'
- 'TrashMob.Shared/**'
- 'TrashMob.Shared.Tests/**'
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use
DOTNET_VERSION2: '8.0.x' # set this to the dotnet version to use
CONFIGURATION: Debug
jobs:
build:
runs-on: windows-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: '5.x'
- name: Determine Version
id: version_step # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v1.1.1
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup DotNet ${{ env.DOTNET_VERSION2 }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION2 }}
- name: Restore
run: dotnet restore .\TrashMob.sln
- name: dotnet publish
run: dotnet publish TrashMob\TrashMob.csproj --configuration ${{ env.CONFIGURATION }} --output "${{env.DOTNET_ROOT}}/trashmobwebapp" --no-restore
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3.1.3
with:
name: .net-app
path: "${{env.DOTNET_ROOT}}/trashmobwebapp"
deploy:
runs-on: windows-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: .net-app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'as-tm-dev-westus2'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_f5393547ee8a491b92cd2220ff5a1b4e }}
package: .