Update main_ourumbraco.yml #18
This file contains hidden or 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
# 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: Build and deploy ASP app to Azure Web App - OurUmbraco | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
permissions: | |
contents: read #This is required for actions/checkout | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MSBuild path | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1.0.5 | |
- name: Restore NuGet packages | |
run: nuget restore | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
- name: npm install | |
working-directory: ./OurUmbraco.Client | |
run: npm install | |
- name: npm build | |
working-directory: ./OurUmbraco.Client | |
run: npm run build | |
- name: Replace secrets in web.config (Windows) | |
run: | | |
(Get-Content web.config) -replace '#{connectionString}#', '${{ secrets.CONNECTION_STRING }}' | Set-Content web.vsts.config | |
(Get-Content web.config) -replace '#{connectionString2}#', '${{ secrets.CONNECTION_STRING2 }}' | Set-Content web.vsts.config | |
- name: Publish to folder | |
run: msbuild OurUmbraco.Site\OurUmbraco.Site.csproj /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\" | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ASP-app | |
path: '/published/**' | |
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@v4 | |
with: | |
name: ASP-app | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'OurUmbraco' | |
slot-name: 'Production' | |
package: . | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_0FC17FE9A9734A9DA6B635D58450BF82 }} |