Skip to content

Update version to 1.2.1 #3

Update version to 1.2.1

Update version to 1.2.1 #3

Workflow file for this run

name: Build, Test & Publish
on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
inputs:
analyze:
description: 'Perform analysis'
type: boolean
required: false
default: false
push: # Run the workflow when pushing to the main branch
pull_request:
types: [ opened, reopened, synchronize ] # Run the workflow for all pull requests
release:
types: [ published ] # Run the workflow when a new GitHub release is published
env:
PROJECT_NAME: I18N.DotNet-Tool
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_DIR: ${{ github.workspace }}/nuget
DOCS_DIR: ${{ github.workspace }}/docs
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Restore dependencies
run: dotnet restore
- name: Patch source documentation
run: |
$LineBeforeAbout = ( Get-Content README.md | Select-String -Pattern "^## About" | Select-Object -First 1 ).LineNumber - 1
( Get-Content README.md | Select-Object -Skip $LineBeforeAbout ) | Set-Content README.md
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build --verbosity normal -c Release -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=Coverage/
- name: Pack
run: dotnet pack --no-build --verbosity normal -c Release -o ${{ env.NUGET_DIR }}
- name: Upload NuGets
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NUGET_DIR }}/*.nupkg
- name: Publish coverage results
uses: coverallsapp/github-action@v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
format: lcov
files: Tool.Test/Coverage/coverage.info
validate-nuget:
runs-on: windows-latest
needs: [ build ]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Install Meziantou NuGet validator
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
- name: Download NuGets
uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NUGET_DIR }}
- name: Validate package
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NUGET_DIR }}/*.nupkg") --excluded-rule-ids 32
analyze:
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' || github.event_name == 'release' || inputs.analyze
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Restore dependencies
run: dotnet restore
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
- name: Build
run: dotnet build --no-restore -c Release
- name: CodeQL analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:csharp"
publish-nuget:
if: github.event_name == 'release'
runs-on: windows-latest
needs: [ validate-nuget, analyze ]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Download NuGets
uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NUGET_DIR }}
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NUGET_DIR }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}