Skip to content

Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 #46

Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0

Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 #46

# 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: Build & Release
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["main"]
permissions:
packages: write
env:
REGISTRY: https://nuget.pkg.github.com/maiorsi/index.json
jobs:
build:
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
FullVersion: ${{ steps.gitversion.outputs.FullSemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
#Install and calculate the new version with GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion # step id used as reference for output values
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
#Build/pack the project
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Build and Pack NuGet package
run: dotnet pack DirectoryServices/DirectoryServices.csproj -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v2
with:
name: nugetPackage
path: DirectoryServices/bin/Release/
release:
runs-on: ubuntu-latest
if: needs.build.outputs.FullVersion == needs.build.outputs.Version
needs: build
steps:
#Push NuGet package to GitHub packages
- name: Download nuget package artifact
uses: actions/[email protected]
with:
name: nugetPackage
- name: Prep packages
run: dotnet nuget add source --username maiorsi --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github ${{ env.REGISTRY }}
- name: Push package to GitHub packages
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate