Skip to content

dep: Update dependency Microsoft.NET.Test.Sdk to v17.7.2 #727

dep: Update dependency Microsoft.NET.Test.Sdk to v17.7.2

dep: Update dependency Microsoft.NET.Test.Sdk to v17.7.2 #727

Workflow file for this run

name: CI
on: [push, pull_request, workflow_dispatch]
env:
ProjectName: ${{ github.event.repository.name }}
NET_TFM: net6.0-windows10.0.22621.0
Configuration: Release
jobs:
check_format:
runs-on: windows-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Checkout code
uses: actions/checkout@v3
- name: Run dotnet format check
run: dotnet format -v diag --verify-no-changes
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Run tests
working-directory: UnitTest
run: dotnet test -c Release
build:
needs: [test, check_format]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Build
shell: pwsh
run: .\build.ps1
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.ProjectName }}
path: ${{ env.ProjectName }}\bin\${{ env.Configuration }}\${{ env.NET_TFM }}\generic\publish\
nuget:
needs: [test, check_format]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
strategy:
matrix:
PackageName:
- STUN
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Build
working-directory: ${{ matrix.PackageName }}
run: dotnet build -c Release
- name: Push nuget packages
working-directory: ${{ matrix.PackageName }}/bin/Release
run: |
dotnet nuget push *.nupkg -s https://nuget.pkg.github.com/HMBSbige -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NuGetAPIKey }} --skip-duplicate
release:
needs: [build, nuget]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ env.ProjectName }}
path: ${{ env.ProjectName }}
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Package
shell: pwsh
run: |
New-Item -ItemType Directory -Path builtfiles -Force > $null
$zip_path = "builtfiles/$env:ProjectName-${{ steps.tag.outputs.tag }}.7z"
7z a -mx9 "$zip_path" ${{ env.ProjectName }}
echo "GENERIC_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Create a new GitHub release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false
artifacts: builtfiles/*
body: |
## Hash
| Filename | SHA-256 |
| :- | :- |
| <sub>${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}.7z</sub> | <sub>${{ env.GENERIC_SHA256 }}</sub> |