Skip to content

Bump YamlDotNet and Microsoft.NETFramework.ReferenceAssemblies (#804) #2954

Bump YamlDotNet and Microsoft.NETFramework.ReferenceAssemblies (#804)

Bump YamlDotNet and Microsoft.NETFramework.ReferenceAssemblies (#804) #2954

Workflow file for this run

name: publish
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- '*'
pull_request:
branches:
- '*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{github.workspace}}/nuget
defaults:
run:
shell: pwsh
jobs:
create_nuget:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all the history so MinGit can compute the version
- name: Set up latest .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet pack NGitLab.sln --configuration Release --output ${{env.NuGetDirectory}} /bl
- uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{env.NuGetDirectory}}/**/*
- uses: actions/upload-artifact@v4
with:
name: binlogs
if-no-files-found: error
retention-days: 7
path: '**/*.binlog'
build_and_test:
runs-on: ubuntu-22.04
env:
TestResultsDirectory: ${{github.workspace}}/TestResults
strategy:
matrix:
# Keep in sync with the version in GitLabDockerContainer.cs
# Available tags: https://hub.docker.com/r/gitlab/gitlab-ee/tags
gitlab:
- 'gitlab/gitlab-ee:15.11.9-ee.0'
- 'gitlab/gitlab-ee:16.11.4-ee.0'
- 'gitlab/gitlab-ee:17.0.2-ee.0'
configuration: [Release]
fail-fast: false
services:
gitlab:
image: ${{matrix.gitlab}}
ports:
- 48624:48624
env:
GITLAB_OMNIBUS_CONFIG: "external_url 'http://localhost:48624/'"
GITLAB_ROOT_PASSWORD: "Pa$$w0rd"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up latest .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Set artifact name
id: set-artifact-name
run: |
$value = "${{matrix.gitlab}}-${{matrix.configuration}}".Replace(':', '-').Replace('/', '-')
"artifact_name=test-results-$value" >> $env:GITHUB_OUTPUT
- name: Run tests
run: dotnet test --configuration ${{matrix.configuration}} --logger trx --results-directory "${{env.TestResultsDirectory}}" --collect:"XPlat Code Coverage" /p:RunAnalyzers=false
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{steps.set-artifact-name.outputs.artifact_name}}
if-no-files-found: error
retention-days: 3
path: ${{env.TestResultsDirectory}}/**/*
- name: Test Report
uses: dorny/test-reporter@v1
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork && (success() || failure())
with:
name: test-results-${{steps.set-artifact-name.outputs.artifact_name}}
path: ${{env.TestResultsDirectory}}/**/*.trx
path-replace-backslashes: 'true'
reporter: dotnet-trx
deploy:
runs-on: ubuntu-22.04
needs: [create_nuget, build_and_test]
steps:
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{env.NuGetDirectory}}
- name: Set up latest .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish NuGet packages
run: |
Write-Host "Current ref: $env:GITHUB_REF"
Write-Host "Searching nupkg in folder: ${{env.NuGetDirectory}}"
$files = Get-ChildItem "${{env.NuGetDirectory}}/*" -Include *.nupkg
foreach ($file in $files) {
if ($env:GITHUB_REF -clike 'refs/tags/*')
{
Write-Host "Pushing NuGet package: $($file.FullName)"
& dotnet nuget push "$($file.FullName)" --api-key "${{secrets.NUGET_APIKEY}}" --source https://api.nuget.org/v3/index.json --force-english-output --skip-duplicate
}
else
{
Write-Host "Not on a tag => Do not push: $($file.FullName)"
}
}