Skip to content

Build & Publish

Build & Publish #23

Workflow file for this run

name: Build & Publish
on:
push:
branches:
- master
tags:
- "*.*.*"
workflow_dispatch:
env:
VERSION: ${{ github.ref_name }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Set Version
run: export VERSION=$(git describe --tags --abbrev=0)
- name: Build
run: |
dotnet build -c Release Source/YoloV8/YoloV8.csproj -p:Version=$VERSION
dotnet build -c GpuRelease Source/YoloV8/YoloV8.csproj -p:Version=$VERSION
- name: Test
run: dotnet test Source/YoloV8.Tests/YoloV8.Tests.csproj
- name: Pack
run: |
dotnet pack -c Release -o . Source/YoloV8/YoloV8.csproj -p:Version=$VERSION
dotnet pack -c GpuRelease -o . Source/YoloV8/YoloV8.csproj -p:Version=$VERSION
- name: Publish
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create $VERSION
--repo ${{ github.event.repository.full_name }}
--title $VERSION
--generate-notes
--verify-tag