.NET #35
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Test projects | |
run: dotnet test | |
- name: Pack projects | |
run: | | |
if [ "${{ github.ref_name }}" == "main" ]; then | |
dotnet pack --configuration Release | |
else | |
VERSION=$(date +"%Y.%m.%d.%H%M") | |
dotnet pack --configuration Release /p:Version=${VERSION}-dev | |
fi | |
- name: Push NuGet packages | |
run: dotnet nuget push **/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |