Skip to content

Merge branch 'legacy/6.0' into legacy/7.0 #5

Merge branch 'legacy/6.0' into legacy/7.0

Merge branch 'legacy/6.0' into legacy/7.0 #5

name: Publish Release NuGets on tag
on:
push:
tags:
- '*'
env:
SOLUTION: DependencyInjection.StaticAccessor.sln
jobs:
publish:
name: Build and Publish
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Restore NuGets
run: dotnet restore ${{ env.SOLUTION }}
- name: Build Solution
run: dotnet build --configuration Release --no-restore ${{ env.SOLUTION }}
- name: Run Tests
run: dotnet test --configuration Release --no-build ${{ env.SOLUTION }}
- name: Delete exists packages
run: Remove-Item -Path nugets -Recurse -Force -ErrorAction SilentlyContinue
- name: Pack NuGets
run: dotnet pack ${{ env.SOLUTION }} --no-build --configuration Release
- name: Publish
run: |
$tagName = "${{ github.ref_name }}"
if ($tagName -like "wasm-*") {
$pkgs = @("DependencyInjection.StaticAccessor.Blazor.WebAssembly")
} elseif ($tagName -like "blazor-*") {
$pkgs = @("DependencyInjection.StaticAccessor.Blazor")
} elseif ($tagName -like "hosting-*") {
$pkgs = @("DependencyInjection.StaticAccessor.Hosting")
} elseif ($tagName -like "basic-*") {
$pkgs = @("DependencyInjection.StaticAccessor")
}
foreach ($pkg in $pkgs) {
$p = ($pkg -replace "\.", "\.") + "\.\d+\.\d+\.\d+\.nupkg"
$nupkg = Get-ChildItem -Path nugets | Where-Object { $_.Name -match $p }
dotnet nuget push $nupkg.FullName -k ${{ secrets.API_KEY }} -s https://api.nuget.org/v3/index.json
}
- name: Create github release
uses: ncipollo/release-action@v1
with:
bodyFile: CHANGELOG.md