Update CSharpier to v0.28.2 #582
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 | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4 | |
with: | |
global-json-file: global.json | |
- name: Restore | |
run: dotnet restore | |
- name: Restore tools | |
run: dotnet tool restore | |
- name: Find version number | |
id: version | |
shell: bash | |
run: | | |
if [[ "${{ github.ref }}" == refs/tags/* ]] | |
then | |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT; | |
else | |
echo "VERSION=0.0.0-alpha.${{ github.run_number }}" >> $GITHUB_OUTPUT; | |
fi | |
- name: Lint - format | |
run: dotnet format --no-restore --verify-no-changes | |
- name: Lint - csharpier | |
run: dotnet csharpier . --check | |
- name: Build | |
run: dotnet build --configuration Release -p:Version=${{ steps.version.outputs.VERSION }} | |
- name: Test | |
run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx" | |
- name: Test Report | |
uses: phoenix-actions/test-reporting@ffcf2ef5f36b35b7ad5844adb00ba806c12aff17 # v13 | |
if: always() | |
with: | |
name: Test results (${{ matrix.os }}) | |
path: "**/*.trx" | |
reporter: dotnet-trx | |
output-to: 'step-summary' | |
fail-on-error: false | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
files: "**/coverage.cobertura.xml" | |
- name: Pack | |
run: dotnet pack --no-build --configuration Release -p:Version=${{ steps.version.outputs.VERSION }} | |
- name: Test - Package | |
shell: bash | |
run: ./build/tool-test.sh | |
- name: Upload NuGet artifact | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: nuget | |
path: src/DotnetSops.CommandLine/bin/nupkg/*.* | |
if-no-files-found: error | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download NuGet artifact | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4 | |
with: | |
name: nuget | |
- name: Create release | |
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
prerelease: ${{ contains(github.ref, '-') }} | |
files: | | |
*.nupkg | |
*.snupkg |