Skip to content

feat (Project): adds initial implementation #1

feat (Project): adds initial implementation

feat (Project): adds initial implementation #1

# 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: Publish to NuGet
# on Push tags matching v1.0.0 or v1.0.0-suffix
on:
push:
tags:
[ "v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-[0-9a-z]+" ]
jobs:
build:
env:
SOLUTION: 'src\Rhythm.TagHelpers.sln'
BUILD_CONFIG: 'Release'
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
# Remove 'v' prefix from tag to match NuGet version format
- name: Set Package Version
run: |
echo "PACKAGE_VERSION=${GITHUB_REF_NAME/v/}" >> "$GITHUB_ENV"
- name: Display Package Version
run: |
echo "Package Version: $PACKAGE_VERSION"
# Restore
- name: Restore dependencies
run: dotnet restore $SOLUTION
# Start packaging process
- name: Pack Rhythm.TagHelpers
run: dotnet pack ./src/Rhythm.TagHelpers/Rhythm.TagHelpers.csproj --no-restore -c $BUILD_CONFIG /p:version=$PACKAGE_VERSION
- name: Publish Packages to NuGet
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json