Skip to content

Commit c8f6641

Browse files
authored
Merge pull request #152 from Swimburger/niels/simplify-msbuild-and-ci
Simplify MSBuild and CI
2 parents eee6fd1 + 03cf593 commit c8f6641

File tree

8 files changed

+124
-285
lines changed

8 files changed

+124
-285
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
name: CI Build
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
libraryVersion:
7-
description: 'The version of the library to use when compiling and packaging.'
8-
default: 0.0.0-alpha
9-
required: false
10-
type: string
11-
4+
workflow_dispatch: {}
125
push:
136
branches: [ "main" ]
147
paths:
@@ -23,17 +16,11 @@ on:
2316
- '.github/workflows/*'
2417
- '.github/actions/*'
2518

26-
workflow_call:
27-
inputs:
28-
libraryVersion:
29-
type: string
30-
description: 'The version of the library to use when compiling and packaging.'
31-
required: true
32-
3319
env:
3420
CI: true
3521
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
3622
DOTNET_NOLOGO: true
23+
MSBUILDTERMINALLOGGER: off
3724

3825
jobs:
3926
build:
@@ -49,117 +36,89 @@ jobs:
4936
with:
5037
dotnet-version: 9.x
5138

52-
- name: Update project versions
53-
run: |
54-
Get-ChildItem **/*.csproj -Recurse | ForEach-Object {
55-
$FileContent = Get-Content $_
56-
$NewVersion = '${{ inputs.libraryVersion }}'
57-
if($NewVersion -eq '') { Return }
58-
If($FileContent -like '*0.0.0-alpha*')
59-
{
60-
$FileContent -replace '0.0.0-alpha',$NewVersion | Set-Content -Path $_
61-
}
62-
}
63-
shell: pwsh
64-
6539
# Build and pack Twilio.AspNet.Common
6640
- name: (Twilio.AspNet.Common) Restore
6741
run: dotnet restore
6842
working-directory: src/Twilio.AspNet.Common/
69-
shell: pwsh
7043

7144
- name: (Twilio.AspNet.Common) Build
7245
run: dotnet build --no-restore --configuration Release
7346
working-directory: src/Twilio.AspNet.Common/
74-
shell: pwsh
7547

7648
- name: (Twilio.AspNet.Common) Pack
77-
run: dotnet pack -c Release -o ..\..\
49+
run: dotnet pack --no-restore --no-build --configuration Release --output ..\..\
7850
working-directory: src/Twilio.AspNet.Common/
79-
shell: pwsh
8051

8152
- name: (Twilio.AspNet.Common) Upload Artifacts
8253
uses: actions/upload-artifact@v4
8354
with:
8455
name: Twilio.AspNet.Common NuGet Package
8556
path: |
86-
Twilio.AspNet.Common.${{ inputs.libraryVersion || '0.0.0-alpha' }}.nupkg
87-
Twilio.AspNet.Common.${{ inputs.libraryVersion || '0.0.0-alpha' }}.snupkg
57+
Twilio.AspNet.Common.*.nupkg
58+
Twilio.AspNet.Common.*.snupkg
8859
8960
# Build, test, and pack Twilio.AspNet.Core
9061
- name: (Twilio.AspNet.Core) Restore
9162
run: dotnet restore
9263
working-directory: src/Twilio.AspNet.Core/
93-
shell: pwsh
9464

9565
- name: (Twilio.AspNet.Core) Build
9666
run: dotnet build --no-restore --configuration Release
9767
working-directory: src/Twilio.AspNet.Core/
98-
shell: pwsh
9968

10069
- name: (Twilio.AspNet.Core.UnitTests) Restore
10170
run: dotnet restore
10271
working-directory: src/Twilio.AspNet.Core.UnitTests/
103-
shell: pwsh
10472

10573
- name: (Twilio.AspNet.Core.UnitTests) Build
10674
run: dotnet build --no-restore
10775
working-directory: src/Twilio.AspNet.Core.UnitTests/
108-
shell: pwsh
10976

11077
- name: (Twilio.AspNet.Core.UnitTests) Test
111-
run: dotnet test --no-build --no-restore
78+
run: dotnet test --no-restore --no-build
11279
working-directory: src/Twilio.AspNet.Core.UnitTests/
113-
shell: pwsh
11480

11581
- name: (Twilio.AspNet.Core) Pack
116-
run: dotnet pack --no-build --no-restore -c Release -o ..\..\
82+
run: dotnet pack --no-restore --no-build --configuration Release --output ..\..\
11783
working-directory: src/Twilio.AspNet.Core/
118-
shell: pwsh
11984

12085
- name: (Twilio.AspNet.Core) Upload Artifacts
12186
uses: actions/upload-artifact@v4
12287
with:
12388
name: Twilio.AspNet.Core NuGet Package
12489
path: |
125-
Twilio.AspNet.Core.${{ inputs.libraryVersion || '0.0.0-alpha' }}.nupkg
126-
Twilio.AspNet.Core.${{ inputs.libraryVersion || '0.0.0-alpha' }}.snupkg
90+
Twilio.AspNet.Core.*.nupkg
91+
Twilio.AspNet.Core.*.snupkg
12792
12893
# Build, test, and pack Twilio.AspNet.Mvc
12994
- name: (Twilio.AspNet.Mvc) Restore
13095
run: dotnet restore
13196
working-directory: src/Twilio.AspNet.Mvc/
132-
shell: pwsh
13397

13498
- name: (Twilio.AspNet.Mvc) Build
13599
run: dotnet build --no-restore --configuration Release
136100
working-directory: src/Twilio.AspNet.Mvc/
137-
shell: pwsh
138101

139102
- name: (Twilio.AspNet.Mvc.UnitTests) Restore
140103
run: dotnet restore
141104
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
142-
shell: pwsh
143105

144106
- name: (Twilio.AspNet.Mvc.UnitTests) Build
145107
run: dotnet build --no-restore
146108
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
147-
shell: pwsh
148109

149110
- name: (Twilio.AspNet.Mvc.UnitTests) Test
150111
run: dotnet test --no-build --no-restore
151112
working-directory: src/Twilio.AspNet.Mvc.UnitTests/
152-
shell: pwsh
153113

154114
- name: (Twilio.AspNet.Mvc) Pack
155-
run: dotnet pack --no-build --no-restore -c Release -o ..\..\
115+
run: dotnet pack --no-build --no-restore --configuration Release --output ..\..\
156116
working-directory: src/Twilio.AspNet.Mvc/
157-
shell: pwsh
158117

159118
- name: (Twilio.AspNet.Mvc) Upload Artifacts
160119
uses: actions/upload-artifact@v4
161120
with:
162121
name: Twilio.AspNet.Mvc NuGet Package
163122
path: |
164-
Twilio.AspNet.Mvc.${{ inputs.libraryVersion || '0.0.0-alpha' }}.nupkg
165-
Twilio.AspNet.Mvc.${{ inputs.libraryVersion || '0.0.0-alpha' }}.snupkg
123+
Twilio.AspNet.Mvc.*.nupkg
124+
Twilio.AspNet.Mvc.*.snupkg

.github/workflows/release.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
name: Release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
libraryVersion:
7-
description: 'The version of the library to use when compiling and packaging.'
8-
required: true
9-
type: string
10-
prerelease:
11-
description: 'Is this a prerelease (alpha/beta/rc)?'
12-
required: true
13-
type: boolean
4+
workflow_dispatch: {}
5+
release:
6+
types: [published]
147

158
env:
169
CI: true
1710
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1811
DOTNET_NOLOGO: true
12+
MSBUILDTERMINALLOGGER: off
1913

2014
jobs:
2115
build:
@@ -24,15 +18,18 @@ jobs:
2418
name: Build, test, and pack
2519
permissions:
2620
checks: write
27-
with:
28-
libraryVersion: ${{ inputs.libraryVersion }}
2921
secrets: inherit
3022

3123
release:
3224
if: contains('["Swimburger","dprothero","AJLange"]', github.actor)
3325
runs-on: ubuntu-latest
3426
needs: [build]
3527
steps:
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: 9.x
32+
3633
- uses: actions/download-artifact@v4
3734
name: Download Twilio.AspNet.Common NuGet Package
3835
with:
@@ -47,31 +44,21 @@ jobs:
4744
name: Download Twilio.AspNet.Mvc NuGet Package
4845
with:
4946
name: Twilio.AspNet.Mvc NuGet Package
50-
51-
- uses: ncipollo/release-action@v1
52-
name: Create GitHub Release and Tag
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
with:
56-
tag: ${{ inputs.libraryVersion }}
57-
artifacts: "*.nupkg,*.snupkg"
58-
token: ${{ secrets.GITHUB_TOKEN }}
59-
prerelease: ${{ inputs.prerelease }}
6047

6148
- name: (Twilio.AspNet.Common) Push to NuGet
6249
run: |
63-
dotnet nuget push 'Twilio.AspNet.Common.${{ inputs.libraryVersion }}.nupkg' \
50+
dotnet nuget push 'Twilio.AspNet.Common.*.nupkg' \
6451
--api-key ${{ secrets.NUGET_API_KEY }} \
6552
--source https://api.nuget.org/v3/index.json
6653
6754
- name: (Twilio.AspNet.Core) Push to NuGet
6855
run: |
69-
dotnet nuget push 'Twilio.AspNet.Core.${{ inputs.libraryVersion }}.nupkg' \
56+
dotnet nuget push 'Twilio.AspNet.Core.*.nupkg' \
7057
--api-key ${{ secrets.NUGET_API_KEY }} \
7158
--source https://api.nuget.org/v3/index.json
7259
7360
- name: (Twilio.AspNet.Mvc) Push to NuGet
7461
run: |
75-
dotnet nuget push 'Twilio.AspNet.Mvc.${{ inputs.libraryVersion }}.nupkg' \
62+
dotnet nuget push 'Twilio.AspNet.Mvc.*.nupkg' \
7663
--api-key ${{ secrets.NUGET_API_KEY }} \
7764
--source https://api.nuget.org/v3/index.json
Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="..\Twilio.AspNet.Shared.props" />
23
<PropertyGroup>
34
<TargetFramework>netstandard2.0</TargetFramework>
4-
<LangVersion>13</LangVersion>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<OutputType>Library</OutputType>
8-
<Version>0.0.0-alpha</Version>
9-
<PackageId>Twilio.AspNet.Common</PackageId>
10-
<PackageVersion>0.0.0-alpha</PackageVersion>
11-
<Authors>Twilio Labs</Authors>
125
<Description>Twilio request classes for handling Twilio webhooks.</Description>
13-
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
14-
<PackageReleaseNotes>Refer to the changelog at https://github.com/twilio-labs/twilio-aspnet/blob/main/CHANGELOG.md</PackageReleaseNotes>
15-
<Copyright>Copyright 2024 (c) Twilio, Inc. All rights reserved.</Copyright>
16-
<PackageTags>twilio;twiml;sms;voice;telephony;phone;aspnet</PackageTags>
17-
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
18-
<PackageProjectUrl>https://github.com/twilio/twilio-aspnet</PackageProjectUrl>
19-
<RepositoryUrl>https://github.com/twilio-labs/twilio-aspnet.git</RepositoryUrl>
20-
<RepositoryType>git</RepositoryType>
21-
<PackageIconUrl>https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/twilio-icon-64x64.png</PackageIconUrl>
22-
<PackageIcon>icon.png</PackageIcon>
23-
<PackageReadmeFile>README.md</PackageReadmeFile>
24-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
25-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
26-
<IncludeSymbols>true</IncludeSymbols>
27-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
286
</PropertyGroup>
29-
<PropertyGroup Condition="'$(CI)' == 'true'">
30-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
31-
</PropertyGroup>
32-
<ItemGroup>
33-
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
34-
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
35-
</ItemGroup>
36-
<ItemGroup>
37-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
38-
<PrivateAssets>all</PrivateAssets>
39-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
40-
</PackageReference>
41-
<PackageReference Include="PolySharp" Version="1.15.0">
42-
<PrivateAssets>all</PrivateAssets>
43-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
44-
</PackageReference>
45-
</ItemGroup>
467
</Project>

src/Twilio.AspNet.Core/Twilio.AspNet.Core.csproj

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="..\Twilio.AspNet.Shared.props" />
23
<PropertyGroup>
34
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
4-
<LangVersion>13</LangVersion>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<OutputType>Library</OutputType>
8-
<Version>0.0.0-alpha</Version>
95
<PackageId>Twilio.AspNet.Core</PackageId>
10-
<PackageVersion>0.0.0-alpha</PackageVersion>
11-
<Authors>Twilio Labs</Authors>
126
<Title>Twilio helper library for ASP.NET Core</Title>
137
<Description>Twilio helper library for ASP.NET Core</Description>
14-
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
15-
<PackageReleaseNotes>Refer to the changelog at https://github.com/twilio-labs/twilio-aspnet/blob/main/CHANGELOG.md</PackageReleaseNotes>
16-
<Copyright>Copyright 2024 (c) Twilio, Inc. All rights reserved.</Copyright>
17-
<PackageTags>twilio;twiml;sms;voice;telephony;phone;aspnet</PackageTags>
18-
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
19-
<PackageProjectUrl>https://github.com/twilio-labs/twilio-aspnet</PackageProjectUrl>
20-
<RepositoryUrl>https://github.com/twilio-labs/twilio-aspnet.git</RepositoryUrl>
21-
<RepositoryType>git</RepositoryType>
22-
<PackageIconUrl>https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/twilio-icon-64x64.png</PackageIconUrl>
23-
<PackageIcon>icon.png</PackageIcon>
24-
<PackageReadmeFile>README.md</PackageReadmeFile>
25-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
26-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
27-
<IncludeSymbols>true</IncludeSymbols>
28-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
29-
</PropertyGroup>
30-
<PropertyGroup Condition="'$(CI)' == 'true'">
31-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
328
</PropertyGroup>
339
<ItemGroup>
34-
<PackageReference Include="PolySharp" Version="1.15.0">
35-
<PrivateAssets>all</PrivateAssets>
36-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
37-
</PackageReference>
3810
<PackageReference Include="Twilio" Version="7.7.0" />
39-
<PackageReference Include="Twilio.AspNet.Common" Version="0.0.0-alpha" />
40-
11+
<!-- Use local project reference for local development, but NuGet package for release -->
12+
<ProjectReference
13+
Condition="'$(Configuration)' == 'Debug'"
14+
Include="..\Twilio.AspNet.Common\Twilio.AspNet.Common.csproj" />
15+
<PackageReference
16+
Condition="'$(Configuration)' != 'Debug'"
17+
Include="Twilio.AspNet.Common"
18+
Version="$(TwilioAspNetCommonVersion)" />
4119
<FrameworkReference Include="Microsoft.AspNetCore.App" />
4220
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
4321
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
4422

45-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
46-
<PrivateAssets>all</PrivateAssets>
47-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
48-
</PackageReference>
49-
50-
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
51-
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
5223
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
5324
<_Parameter1>Twilio.AspNet.Core.UnitTests</_Parameter1>
5425
</AssemblyAttribute>

0 commit comments

Comments
 (0)