HealthCheck #34
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
name: .NET Core CI | |
on: [push] | |
env: | |
AZURE_WEBAPP_NAME: wrkshpwebfrontend | |
AZURE_WEBAPP_PACKAGE_PATH: '.' | |
DOTNET_VERSION: '6.0.x' | |
AZURE_FUNCTION_NAME: wrkshptodofunction | |
AZURE_FUNCTION_PACKAGE_PATH: '.' | |
DOTNET_VERSION_FUNCTION: '6.0.x' | |
jobs: | |
frontend: | |
#if: ${{ false }} | |
environment: DevWorkshop | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
include-prerelease: true | |
- name: Build with dotnet | |
run: dotnet build Frontend --configuration Release | |
- name: dotnet publish | |
run: dotnet publish Frontend -c Release -o ${{env.AZURE_WEBAPP_PACKAGE_PATH}}/myapp | |
#- name: Upload artifact for deployment job | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: .net-app | |
# path: ${{env.AZURE_WEBAPP_PACKAGE_PATH}}/myapp | |
- name: "Package content" | |
run: | | |
Get-ChildItem ${{env.AZURE_WEBAPP_PACKAGE_PATH}}/myapp | Compress-Archive -Destination ${{env.AZURE_WEBAPP_PACKAGE_PATH}}/myapp/app.zip | |
shell: pwsh | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{env.AZURE_WEBAPP_NAME}} | |
slot-name: 'production' | |
publish-profile: ${{ secrets.PUBLISH_PROFILE }} | |
package: ${{env.AZURE_WEBAPP_PACKAGE_PATH}}/myapp/app.zip | |
annotations: | |
#if: ${{ false }} | |
needs: frontend | |
environment: DevWorkshop | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Azure Login" | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} # optional | |
# Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS | |
# not yet supported by login@v1 action | |
# for now this is still required, despite deprecated | |
# az ad sp create-for-rbac --sdk-auth | |
- uses: actions/checkout@v2 | |
- name: "Publish annotation" | |
shell: bash | |
#./release-annotation.sh tst "Release for $branch" "Release for $branch and SHA ${GITHUB_SHA}" "${GITHUB_ACTOR}" "Developmentworkshop" "devworkshop" | |
run: | | |
branch=${GITHUB_HEAD_REF##*/} | |
./release-annotation.sh "Release for frontend" "Release for frontend and SHA ${GITHUB_SHA}" "${GITHUB_ACTOR}" "Developmentworkshop" "devworkshop" | |
frontend_v2: | |
if: ${{ false }} | |
environment: DevWorkshop | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@main | |
# Setup .NET Core SDK | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# Run dotnet build and publish | |
- name: dotnet build and publish | |
working-directory: ./Frontend | |
run: | | |
dotnet restore | |
dotnet build --configuration Release | |
dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' | |
# Deploy to Azure Web apps | |
- name: 'Run Azure webapp deploy action using publish profile credentials' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name | |
publish-profile: ${{ secrets.PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation | |
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/Frontend/myapp' | |
function: | |
#if: ${{ false }} | |
environment: DevWorkshop | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@main | |
# Setup .NET Core SDK | |
- name: Setup .NET Core 3.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.x | |
- name: Setup .NET Core 5.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Setup .NET Core 6.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
# Run dotnet build and publish Function | |
- name: dotnet build and publish Function | |
working-directory: ./Function | |
run: | | |
dotnet clean | |
dotnet restore | |
dotnet build --configuration Release | |
dotnet publish -c Release -o '${{ env.AZURE_FUNCTION_PACKAGE_PATH }}/myfunc' | |
# Deploy to Azure Functions | |
- name: 'Run Azure Function deploy action using publish profile credentials' | |
uses: azure/functions-action@v1 | |
with: | |
app-name: ${{ env.AZURE_FUNCTION_NAME }} # Replace with your app name | |
publish-profile: ${{ secrets.PUBLISH_PROFILE_FUNCTION }} # Define secret variable in repository settings as per action documentation | |
package: '${{ env.AZURE_FUNCTION_PACKAGE_PATH }}/Function/myfunc' | |
annotations_function: | |
#if: ${{ false }} | |
needs: function | |
environment: DevWorkshop | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Azure Login" | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} # optional | |
# Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS | |
# not yet supported by login@v1 action | |
# for now this is still required, despite deprecated | |
# az ad sp create-for-rbac --sdk-auth | |
- uses: actions/checkout@v2 | |
- name: "Publish annotation" | |
shell: bash | |
run: | | |
branch=${GITHUB_HEAD_REF##*/} | |
./release-annotation.sh "Release for function" "Release for function and SHA ${GITHUB_SHA}" "${GITHUB_ACTOR}" "Developmentworkshop" "devworkshop" |