Publish Static Serializer #20
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
# This is a basic workflow to help you get started with Actions | |
name: Publish Static Serializer | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
VSTEST_CONNECTION_TIMEOUT: 180 | |
DOTNET_NOLOGO: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout aaubry/yamldotnet | |
id: yamldotnet | |
uses: actions/checkout@v3 | |
with: | |
repository: aaubry/yamldotnet | |
ref: master | |
fetch-depth: 0 | |
path: yamldotnet | |
submodules: 'true' | |
- name: Get current version | |
id: version | |
working-directory: yamldotnet | |
run: | | |
VERSION=$(git tag -l --sort=-v:refname v* | head -n 1 | sed -e 's/^v//') | |
echo "Using $VERSION" | |
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Install dotnet 3.1 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 3.1.x | |
- name: Install dotnet 6.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install dotnet 7.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Build | |
id: build | |
working-directory: yamldotnet | |
run: dotnet build -c Release YamlDotNet.sln | |
- name: Test | |
id: test | |
working-directory: yamldotnet | |
run: dotnet test -c Release --no-build YamlDotNet.sln | |
- name: Pack | |
id: pack | |
working-directory: yamldotnet/YamlDotNet.Analyzers.StaticGenerator | |
run: | | |
echo "Setting NuspecProperties in csproj file" | |
sed -i '/<PropertyGroup>/a <NuspecProperties>PackageVersion=$(PackageVersion)<\/NuspecProperties>' YamlDotNet.Analyzers.StaticGenerator.csproj | |
echo "Copying nuspec" | |
cp $GITHUB_WORKSPACE/YamlDotNet.Analyzers.StaticGenerator.nuspec . | |
echo "Packing" | |
dotnet pack YamlDotNet.Analyzers.StaticGenerator.csproj \ | |
-o $GITHUB_WORKSPACE/packed \ | |
-p:NuspecFile=./YamlDotNet.Analyzers.StaticGenerator.nuspec \ | |
-p:PackageVersion=$PACKAGE_VERSION | |
- name: Push | |
id: push | |
working-directory: packed | |
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
- name: Create a Release | |
uses: elgohr/Github-Release-Action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
title: ${{ env.PACKAGE_VERSION }} | |