Skip to content

Bump xunit from 2.4.2 to 2.7.0 #100

Bump xunit from 2.4.2 to 2.7.0

Bump xunit from 2.4.2 to 2.7.0 #100

name: Build, Test, and Deploy
on:
push:
branches: [ main ]
release:
types: [created]
pull_request:
branches: [ main ]
defaults:
run:
shell: pwsh
env:
baseVersion: 1.0.0
jobs:
automerge:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3.10.1
with:
use-github-auto-merge: true
build-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
3.1.x
- name: Restore dependencies
run: dotnet restore
- name: Set Version
run: |
echo "${{ github.ref }}"
if ("${{ github.ref }}".startsWith("refs/tags/v")) {
$tagVersion = "${{ github.ref }}".substring(11)
echo "buildVersion=$tagVersion.${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "nugetVersion=$tagVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "preRelease=false" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
echo "buildVersion=${{ env.baseVersion }}.${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "nugetVersion=${{ env.baseVersion }}-ci${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Build
run: dotnet build -p:Version=${{ env.buildVersion }} -p:ContinuousIntegrationBuild=True --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Pack
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet pack -p:PackageVersion=${{ env.nugetVersion }} --configuration Release -o ${{env.DOTNET_ROOT}}/DotnetSitemapGenerator --no-build
- name: Upload Artifacts
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: NuGet
path: ${{env.DOTNET_ROOT}}/DotnetSitemapGenerator
deploy:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build-and-test
environment:
name: 'Production'
url: 'https://www.nuget.org/packages/DotnetSitemapGenerator/'
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: NuGet
- name: Push NuGet
run: |
$tagVersion = "${{ github.ref }}".substring(11)
echo "tagVersion=$tagVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
dotnet nuget push DotnetSitemapGenerator.$tagVersion.nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
- name: Upload nupkg to Releases
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
generate_release_notes: true
files: DotnetSitemapGenerator.${{ env.tagVersion }}.nupkg