Skip to content

Set PackageValidationBaselineVersion to 0.5.0 (#129) #412

Set PackageValidationBaselineVersion to 0.5.0 (#129)

Set PackageValidationBaselineVersion to 0.5.0 (#129) #412

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: dotnet
permissions: read-all
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
version:
description: 'Release version to tag and create'
required: false
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace }}/nuget
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
configuration: [Debug, Release]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c ${{ matrix.configuration }} --no-restore
- name: Test
run: dotnet test -c ${{ matrix.configuration }} --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.os }},${{ matrix.configuration }}
format:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Format verify no changes
run: dotnet format --verify-no-changes
test-parsers:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
configuration: [Debug, Release]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c ${{ matrix.configuration }} --no-restore
- name: Test Parsers
shell: pwsh
run: ./test-parsers.ps1
pack:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Create tag (to set version of nuget package)
if: ${{ github.event.inputs.version != '' && github.actor == 'nietras' }}
run: |
git tag v${{ github.event.inputs.version }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
# No need to define min ver version globally now since only uploading release
# when version and tag is defined.
# - name: Install MinVer
# run: dotnet tool install --global minver-cli --version 4.3.0
# - name: Run MinVer
# run: minver -v d -t v -p preview
# - name: Run MinVer (output)
# id: minverrun
# run: |
# echo "MINVERVERSIONOVERRIDE=$(minver -v d -t v -p preview)" >> $env:GITHUB_ENV
# - name: Output MinVer
# run: |
# echo "${{ env.MINVERVERSIONOVERRIDE }}"
- name: Pack nuget package
run: dotnet pack -c Release --output ${{ env.NuGetDirectory }}
- name: Get version of dll
run: (Get-Item ./artifacts/bin/Sep/release_net8.0/Sep.dll).VersionInfo.ProductVersion
- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*nupkg
create-release-push:
needs: [ build, pack ]
runs-on: windows-latest
permissions:
contents: write
if: ${{ github.event.inputs.version != '' && github.actor == 'nietras' }}
steps:
- uses: actions/checkout@v3
- name: Download nuget packages
uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: ${{ github.event.inputs.version }}
draft: true
- name: Create tag (for release)
run: |
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}
- name: Upload nupkg package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.NuGetDirectory }}/Sep.${{ github.event.inputs.version }}.nupkg
asset_name: Sep.${{ github.event.inputs.version }}.nupkg
asset_content_type: application/zip
- name: Upload snupkg package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.NuGetDirectory }}/Sep.${{ github.event.inputs.version }}.snupkg
asset_name: Sep.${{ github.event.inputs.version }}.snupkg
asset_content_type: application/zip
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Push nupkg package
run: dotnet nuget push ${{ env.NuGetDirectory }}/Sep.${{ github.event.inputs.version }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Push snupkg package
run: dotnet nuget push ${{ env.NuGetDirectory }}/Sep.${{ github.event.inputs.version }}.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate