Publish NuGet.org #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish NuGet.org | |
on: | |
workflow_dispatch: | |
inputs: | |
typeBuild: | |
description: "É beta? (digite -beta)" | |
required: false | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
# Stop wasting time caching packages | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending usage data to Microsoft | |
DOTNET_CLI_TELEMETRY_OPTOUT: false | |
jobs: | |
deploy-package: | |
runs-on: windows-latest | |
steps: | |
- name: "Checkout branch" | |
uses: actions/checkout@main | |
- name: "Set Variables" | |
id: envs | |
run: | | |
echo "::set-output name=VERSION_PROJECT::1.1.${Env:GITHUB_RUN_NUMBER}" | |
echo "::set-output name=VERSION_PACKAGE::1.1.${Env:GITHUB_RUN_NUMBER}${{ github.event.inputs.typeBuild }}" | |
- name: "Variables Test" | |
run: | | |
echo Version: ${{ steps.envs.outputs.VERSION_PROJECT }} | |
echo Version2: ${{ steps.envs.outputs.VERSION_PACKAGE }} | |
- name: "Force url nuget" | |
uses: fabriciomurta/ensure-nuget-source@v1 | |
with: | |
name: "nuget.org" | |
url: "https://api.nuget.org/v3/index.json" | |
- name: "Setup .NET Core" | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Clean | |
run: dotnet clean .\src\Vip.DFe.sln && dotnet nuget locals all --clear | |
- name: Restore dependencies | |
run: dotnet restore .\src\Vip.DFe.sln --force | |
- name: Build Project | |
run: dotnet build .\src\Vip.DFe.sln --configuration Release -p:Version=${{ steps.envs.outputs.VERSION_PROJECT }} | |
- name: Test Project | |
run: dotnet test .\src\Vip.DFe.sln | |
- name: Create Package | |
run: dotnet pack .\src\Vip.DFe\Vip.DFe.csproj --configuration Release -p:Version=${{ steps.envs.outputs.VERSION_PACKAGE }} | |
- name: Publish Package | |
run: dotnet nuget push .\src\Vip.DFe\bin\Release\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }} |