Skip to content

Create release

Create release #3

name: Create release
on:
workflow_dispatch:
inputs:
release_version:
type: string
required: true
description: Release version
default: '1.0.0'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.x
3.x
6.x
7.x
8.x
- name: Run Tests
working-directory: src
run: dotnet test --configuration Release
- name: Build projects
run: |
PROJECTS="KissLog KissLog.RestClient KissLog.CloudListeners KissLog.AspNet.Web KissLog.AspNet.Mvc KissLog.AspNet.WebApi KissLog.AspNetCore"
for project in $PROJECTS; do
echo "Building $project..."
dotnet build "src/$project/$project.csproj" --configuration Release /p:Version=${{ github.event.inputs.release_version }}
dotnet pack "src/$project/$project.csproj" --no-build -o . /p:PackageVersion=${{ github.event.inputs.release_version }}
done
- name: Publish NuGet packages
run: |
dotnet nuget push "./*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Publish GitHub packages
run: |
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.KISSLOG_RELEASE }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/KissLog-net/index.json"
dotnet nuget push "./*.nupkg" --source "github"
- name: Release
uses: softprops/[email protected]
with:
body: v${{ github.event.inputs.release_version }}
draft: false
tag_name: v${{ github.event.inputs.release_version }}
files: |
./*.nupkg