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 | ||
on: | ||
workflow_call: | ||
inputs: | ||
project_path: | ||
type: string | ||
required: true | ||
test_project_path: | ||
type: string | ||
required: true | ||
package_name: | ||
type: string | ||
required: true | ||
secrets: | ||
VIM_NUGET_PUSH: | ||
description: 'The API key needed to push the package' | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
############################ | ||
########## SETUP ########### | ||
############################ | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
steps: | ||
- name: Install NuGet | ||
- uses: nuget/setup-nuget@v2 | ||
with: | ||
nuget-version: '5.x' | ||
- name: Check version | ||
# composite actions don't support if-statements yet | ||
run: | | ||
! [[ "${{ inputs.package_name }}" == "" ]] && \ | ||
./devops/check-nuget-version.sh ${{ inputs.project_path }} ${{ inputs.package_name }} \ | ||
|| true | ||
shell: bash | ||
############################ | ||
########## BUILD ########### | ||
############################ | ||
- name: Restore dependencies | ||
run: dotnet restore ${{ inputs.project_path }} | ||
shell: bash | ||
- name: Build | ||
run: dotnet build -c Release --no-restore ${{ inputs.project_path }} | ||
shell: bash | ||
- name: Test | ||
run: dotnet test -c Release ${{ inputs.test_project_path }} | ||
shell: bash | ||
- name: Pack NuGet package | ||
env: | ||
NUGET_ENABLE_LEGACY_CSPROJ_PACK: true | ||
run: nuget pack ${{ inputs.project_path }} -IncludeReferencedProjects -Symbols -SymbolPackageFormat snupkg -OutputDirectory . -NonInteractive -Properties Configuration=Release -Exclude *.tt | ||
shell: bash | ||
############################## | ||
########## PUBLISH ########### | ||
############################## | ||
- name: Push NuGet package | ||
env: | ||
NUGET_ENABLE_LEGACY_CSPROJ_PACK: true | ||
run: nuget push ${{ inputs.package_name }}*.nupkg -ApiKey ${{ secrets.VIM_NUGET_PUSH }} -Source https://api.nuget.org/v3/index.json | ||
shell: bash | ||
- name: Tag commit | ||
run: ./devops/cs-tag-commit.sh ${{ inputs.project_path }} ${{ inputs.package_name }} | ||
shell: bash |