Skip to content

0.3.0 - add support for images, threads, and posting CLI #10

0.3.0 - add support for images, threads, and posting CLI

0.3.0 - add support for images, threads, and posting CLI #10

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: on-release-publish-nuget
on:
release:
types:
- published
defaults:
run:
shell: pwsh
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace }}/nuget
jobs:
build-and-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # for MinVer
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Build project
run: ./build-sln.sh
- name: Run tests
run: ./run-unit-tests.sh
- name: Create NuGet packages
run: ./prepare-nuget-packages.sh
- uses: actions/upload-artifact@v4
with:
name: nuget-packages
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*.nupkg
validate_nuget:
runs-on: ubuntu-latest
needs: [build-and-package]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ${{ env.NuGetDirectory }}
- name: Install nuget validator
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
# See: https://www.nuget.org/packages/Meziantou.Framework.NuGetPackageValidation.Tool#readme-body-tab
# If some rules are not applicable, you can disable them with --excluded-rules or --excluded-rule-ids
- name: Validate package
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
deploy:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [validate_nuget]
steps:
- name: Get packages artifact
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ${{ env.NuGetDirectory }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}