Amend #49
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: Build, Test and Deploy | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
DOTNET_VERSION: 8.0.x | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure GitHub Pages | |
id: pages | |
uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build | |
env: | |
SNAPSHOOTER_STRICT_MODE: true | |
- name: Publish | |
run: dotnet publish Client -o out | |
- name: Upload Pages Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: out/wwwroot | |
deploy-github-pages: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: build-and-test | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "github-pages" | |
cancel-in-progress: false | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
deploy-function-app: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: build-and-test | |
environment: azure-functions | |
runs-on: ubuntu-latest | |
concurrency: | |
group: "azure-functions" | |
cancel-in-progress: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Build | |
run: dotnet build Server.Functions -c Release -o out | |
- name: Upload build artifact | |
uses: actions/[email protected] | |
with: | |
name: azure-function-app | |
path: out | |
- name: Deploy to Azure Functions | |
uses: Azure/[email protected] | |
with: | |
app-name: jacobjmarks-dotnet-qs | |
package: out | |
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} |