Skip to content

Commit

Permalink
Update Build Script to support Pull Request Packages Again
Browse files Browse the repository at this point in the history
Cleaned up some logic for diagnostic builds as well so we have a single build command
  • Loading branch information
michael-hawker committed Aug 12, 2023
1 parent 0fb6cdb commit 5e19e64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
env:
DOTNET_VERSION: ${{ '7.0.x' }}
ENABLE_DIAGNOSTICS: true
MSBUILD_VERBOSITY: normal
#COREHOST_TRACE: 1
COREHOST_TRACEFILE: corehosttrace.log
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
Expand Down Expand Up @@ -122,27 +123,25 @@ jobs:
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
if: ${{ matrix.platform == 'WinUI3' }}

- name: MSBuild (With diagnostics)
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m /bl -v:diag

- name: MSBuild
if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m ${{ github.ref == 'refs/heads/main' && '' || format('-p:PreviewVersion="pull-{0}+build.{1}"', github.event.number, github.run_number) }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }} -v:${{ env.MSBUILD_VERBOSITY }}

# Build All Packages
- name: pack experiments
working-directory: ./tooling/Scripts/
run: ./PackEachExperiment.ps1 all

# Push Packages to our DevOps Artifacts Feed (see nuget.config)
- name: Add source
- name: Add source (main)
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget update source MainLatest --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}

- name: Add source (pull requests)
if: ${{ github.ref != 'refs/heads/main' }}
run: dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json --name PullRequests --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}

- name: Push packages
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source MainLatest --skip-duplicate
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source ${{ github.ref == 'refs/heads/main' && 'MainLatest' || 'PullRequests' }} --skip-duplicate

# Run tests
- name: Setup VSTest Path
Expand Down Expand Up @@ -243,7 +242,7 @@ jobs:
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App.Wasm.csproj
- name: dotnet build
working-directory: ./${{ env.HEADS_DIRECTORY }}/AllComponents/Wasm/
run: dotnet build /r /bl
run: dotnet build /r /bl -v:${{ env.MSBUILD_VERBOSITY }}

# TODO: Do we want to run tests here? Can we do that on linux easily?

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<MajorVersion>8</MajorVersion>
<MinorVersion>0</MinorVersion>
<PreviewVersion>preview</PreviewVersion>
<PreviewVersion Condition="'$(PreviewVersion)' == ''">preview</PreviewVersion>

<PackageIdPrefix>CommunityToolkit</PackageIdPrefix>
<RepositoryDirectory>$([MSBuild]::EnsureTrailingSlash('$(MSBuildThisFileDirectory)'))</RepositoryDirectory>
Expand Down

0 comments on commit 5e19e64

Please sign in to comment.