Use SYSUTCDATETIME and SYSDATETIME instead of GETUTCDATE and GETDATE … #182
Workflow file for this run
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: Build and publish package | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Set release env | |
run: | | |
major_version=${GITHUB_REF:10:1} \ | |
&& echo "MAJOR_VERSION=${major_version}" >> $GITHUB_ENV \ | |
&& [[ $major_version = 5 ]] && echo "PROJECT_TARGET=netstandard2.1" >> $GITHUB_ENV || [[ $major_version = 6 ]] && echo "PROJECT_TARGET=net6.0" >> $GITHUB_ENV || echo "PROJECT_TARGET=net8.0" >> $GITHUB_ENV \ | |
&& echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Setup .NET5 environment | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.x.x' | |
- name: Setup .NET6 environment | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.x.x' | |
- name: Setup .NET8 environment | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.x.x' | |
- name: Build project | |
run: | | |
for p in $(find ./src -name *.csproj); do dotnet build $p --framework ${{env.PROJECT_TARGET}} --configuration Release; done | |
- name: Generate a NuGet package | |
run: dotnet pack -p:TargetFrameworks=${{env.PROJECT_TARGET}} -p:PackageVersion=${{env.RELEASE_VERSION}} --no-build -c Release -o . | |
- name: Push to GitHub package registry | |
run: dotnet nuget push "*.nupkg" -k ${{secrets.NUGETORGTOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |