Skip to content

Commit

Permalink
Fixed pipelines. Improved build skipping double compile. Improved pub…
Browse files Browse the repository at this point in the history
…lish - only projects, not solutions
  • Loading branch information
mtirionMSFT committed Oct 29, 2024
1 parent 23c493f commit 2821a9f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ jobs:
dotnet-version: 8.x

# Loop through all the solutions in src and restore, build & test
# Skip DocFxCompanionTools.sln, as it is a combination of all solutions.
- name: Restore, build & test
shell: pwsh
run: |
foreach ($sln in (Get-ChildItem -Recurse src\*.sln)) {
foreach ($sln in (Get-ChildItem -Recurse src\*.sln -Exclude DocFxCompanionTools.sln)) {
Write-Host "Start building $($sln.FullName)"
& dotnet restore $sln.FullName
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,30 @@ jobs:
toTag: ${{ steps.gitversion.outputs.Sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create GitHub release with created zip-file and CHANGELOG for Chocolatey and releases
# NOTE: this is where we prepend "v" before the version in the tag/release
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "./tools.zip"
body: ${{steps.github_release.outputs.changelog}}
tag: "v${{ steps.gitversion.outputs.MajorMinorPatch }}"
token: ${{ secrets.GITHUB_TOKEN }}

# package and publish Chocolatey package for this version
# We publish the nuspec file which references the tools.zip in releases.
- name: Publish to Chocolatey
env:
CHOCO_TOKEN: ${{ secrets.CHOCO_TOKEN }}
run: pwsh .\pack.ps1 -publish -version ${{ steps.gitversion.outputs.MajorMinorPatch }}

# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
- name: Publish separate tools to NuGet
run: |
foreach($file in (Get-ChildItem "./artifacts" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_TOOLS }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if (Test-Path -Path $solution.assetZipPath) {
Remove-Item $solution.assetZipPath
}

# Build all dotnet solution into $solution.targetFolder as single exe's
foreach ($sln in (Get-ChildItem -Recurse src\*.sln)) {
# Build all dotnet projects into $solution.targetFolder as single exe's. Skip Test projects.
foreach ($sln in (Get-ChildItem -Recurse src\*\*.csproj -Exclude *.Test.*)) {
Write-Host "Start building $($sln.FullName)"
& dotnet publish $sln.FullName -c Release -r win-x64 /p:PublishSingleFile=true /p:CopyOutputSymbolsToPublishDirectory=false --self-contained false -o $solution.targetFolder
}
Expand Down

0 comments on commit 2821a9f

Please sign in to comment.