Skip to content

Build & Publish NuGet Package #12

Build & Publish NuGet Package

Build & Publish NuGet Package #12

Workflow file for this run

name: Build & Publish NuGet Package
on:
push:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
paths-ignore:
- '**.md'
workflow_dispatch:
inputs:
version_number:
description: "Package version, e.g. 1.10.5"
required: true
type: string
env:
VERSION_NAME: ${{ inputs.version_number || github.head_ref }}
jobs:
publish-core:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Set VERSION variable from tag or the input
run: echo "VERSION=${VERSION_NAME#\/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Pack
run: dotnet pack --configuration Release --property:Version=${VERSION} --output . src/core/SimpleCDN.csproj
- name: Push
run: dotnet nuget push SimpleCDN.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
publish-redis-extension:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Set VERSION variable from tag or the input
run: echo "VERSION=${VERSION_NAME#\/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Pack
run: dotnet pack --configuration Release --property:Version=${VERSION} --output . extensions/Redis/SimpleCDN.Extensions.Redis.csproj
- name: Push
run: dotnet nuget push SimpleCDN.Extensions.Redis.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}