Update dotnet.yml

This commit is contained in:
ahjephson
2024-11-01 22:17:49 +00:00
committed by GitHub
parent cad62c216a
commit df1f260269

View File

@@ -1,28 +1,63 @@
# This workflow will build a .NET project name: Build and Test Blazor WebAssembly
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on: on:
push: push:
branches: [ "master" ] branches:
- master
pull_request: pull_request:
branches: [ "master" ] branches:
- '**'
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
- name: Setup .NET uses: actions/checkout@v2
uses: actions/setup-dotnet@v4
with: - name: Install .NET
dotnet-version: 8.0.x uses: actions/setup-dotnet@v2
- name: Restore dependencies with:
run: dotnet restore dotnet-version: '8.x'
- name: Build
run: dotnet build --no-restore - name: Install GitVersion
- name: Test uses: GitTools/actions/gitversion/setup@v0.9.14
run: dotnet test --no-build --verbosity normal with:
versionSpec: '5.x'
- name: Get GitVersion
id: gitversion
run: |
gitversion /output json /showvariable FullSemVer > gitversion.json
shell: bash
- name: Install GitVersion in JSON
id: extract_version
run: echo "##[set-output name=version;]$(jq -r '.FullSemVer' gitversion.json)"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release
- name: Run Tests
run: dotnet test --no-build --configuration Release
- name: Publish (only on master)
if: github.ref == 'refs/heads/master'
run: dotnet publish -c Release -o output
- name: Prepare Release ZIP
if: github.ref == 'refs/heads/master'
run: |
mv output/wwwroot public
zip -r "qbt-mud-v${{ steps.extract_version.outputs.version }}.zip" public
- name: Upload to GitHub Release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: "qbt-mud-v${{ steps.extract_version.outputs.version }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}