Skip to content

Deploy Tool to NuGet #16

Deploy Tool to NuGet

Deploy Tool to NuGet #16

name: Deploy Tool to NuGet
on:
workflow_dispatch:
branches: [ main ]
jobs:
build:
name: "Build Project"
runs-on: ubuntu-latest
env:
MajorVersion: 0
MinorVersion: 5
steps:
- uses: actions/checkout@v2
- name: Get current date
id: version
run: echo "::set-output name=date::$(date +'%Y%m.%d')"
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
run: echo "Branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "Branch=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Set Version Prefix
env:
VERPREF: ${{ format('{0}.{1}.{2}{3}', env.MajorVersion, env.MinorVersion, steps.date.outputs.date, github.run_number) }}
run: echo "VersionPrefix=$(echo ${VERPREF})" >> $GITHUB_ENV
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.x
- name: Build Project
run: dotnet pack ./src/HaveIBeenPwned.PwnedPasswords.Downloader/HaveIBeenPwned.PwnedPasswords.Downloader.csproj --configuration Release
- name: Publish Nuget to GitHub registry
run: dotnet nuget push ./src/HaveIBeenPwned.PwnedPasswords.Downloader/nupkg/*.nupkg -k ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols