Created
February 13, 2024 22:41
-
-
Save graywolfcorp/b5dcf81cd395ccc12b4034d873ac244b to your computer and use it in GitHub Desktop.
yml to build a web app and web job from the same repo and publish to Azure
This file contains 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: gwcblazor - dev | |
on: | |
push: | |
branches: | |
- dev | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: ./webapp | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: checkout repo for webapp | |
uses: actions/checkout@v4 | |
with: | |
path: './webapp' | |
- name: checkout repo for webjob | |
uses: actions/checkout@v4 | |
with: | |
path: './webjob' | |
- name: check out httprequest | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.TOKEN }} | |
repository: graywolfcorp/GWC.HttpRequest.Library | |
path: './GWC.HttpRequest.Library' | |
ref: dev | |
- name: remove database project from webapp | |
run: dotnet sln GWCBlazor.sln remove GWC.Blazor.Database | |
working-directory: ./webapp | |
- name: remove webjob project from web app | |
run: dotnet sln GWCBlazor.sln remove GWC.Blazor.WebBatch | |
working-directory: ./webapp | |
- name: remove database project from webjob | |
run: dotnet sln GWCBlazor.sln remove GWC.Blazor.Database | |
working-directory: ./webjob | |
- name: remove webapp project from web job | |
run: dotnet sln GWCBlazor.sln remove GWC.Blazor.WebApp | |
working-directory: ./webjob | |
- name: directory | |
run: dir * | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.x' | |
include-prerelease: true | |
- name: Build webapp with dotnet | |
run: dotnet build --configuration Release | |
working-directory: ./webapp | |
- name: dotnet publish webapp | |
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp | |
working-directory: ./webapp | |
- name: Build webjob with dotnet | |
run: dotnet build --configuration Release | |
working-directory: ./webjob | |
- name: dotnet publish webjob | |
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp/App_Data/Jobs/Continuous/GWC.Blazor.WebBatch | |
working-directory: ./webjob | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: .net-app | |
path: ${{env.DOTNET_ROOT}}/myapp | |
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: 'gwcblazor' | |
slot-name: 'Production' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_956CAA1C2B7D40AC95A329F17C7C1154 }} | |
package: . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment