Skip to content

Initial release

Initial release #1

Workflow file for this run

name: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
env:
DOTNET_VERSION: '9.0.x'
SOLUTION_FILE: ""
jobs:
build_and_test:
name: Build, Test and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Build
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.SOLUTION_FILE }} --configuration Release --no-build --verbosity normal
# - name: Upload build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: build-artifacts
# path: |
# **/bin/Release/**/*.dll
# **/bin/Release/**/*.pdb
# retention-days: 7
- name: Get version
if: github.event_name == 'release'
id: get_version
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Pack
if: github.event_name == 'release'
run: dotnet pack ${{ env.SOLUTION_FILE }} /p:Version=${{ env.VERSION }} --configuration Release --no-build -o packages
- name: Upload packages
if: github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: packages
path: |
packages/*.nupkg
retention-days: 7
- name: Publish
if: github.event_name == 'release'
run: dotnet nuget push packages/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json