Skip to content

Commit 36735a3

Browse files
committed
Try github actions.
1 parent 2a4fc5b commit 36735a3

File tree

2 files changed

+74
-17
lines changed

2 files changed

+74
-17
lines changed

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Package and publish nupkg
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Build app, sign files with Trusted Signing and deploy to NuGet
9+
runs-on: windows-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup MSBuild
15+
uses: microsoft/setup-msbuild@v1
16+
17+
- name: Restore NuGet packages
18+
run: cd src && nuget restore && cd ..
19+
20+
- name: Build
21+
run: msbuild .\src\Org.Openfeed.Client\Org.Openfeed.Client.csproj /t:Pack /p:Configuration=Release /p:PackageOutputPath=..\..\publish
22+
23+
- name: List files in publish directory
24+
run: dir .\publish
25+
26+
- name: Upload build artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: BuildArtifacts
30+
path: ./publish/*.nupkg
31+
32+
sign:
33+
needs: build
34+
runs-on: windows-latest
35+
permissions:
36+
id-token: write # Required for requesting the JWT
37+
38+
steps:
39+
- name: Download build artifacts
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: BuildArtifacts
43+
path: BuildArtifacts
44+
45+
# .NET is required on the agent for the tool to run
46+
- name: Setup .NET
47+
uses: actions/setup-dotnet@v3
48+
with:
49+
dotnet-version: "9.x"
50+
51+
# Install the code signing tool
52+
- name: Install Sign CLI tool
53+
run: dotnet tool install --tool-path . --prerelease sign
54+
55+
# Login to Azure using a ServicePrincipal configured to authenticate agaist a GitHub Action
56+
- name: "Az CLI login"
57+
uses: azure/login@v1
58+
with:
59+
allow-no-subscriptions: true
60+
creds: ${{ secrets.AZURE_CREDS }}
61+
62+
# Run the signing command
63+
- name: Sign artifacts
64+
shell: pwsh
65+
run: >
66+
./sign code trusted-signing *.nupkg --trusted-signing-endpoint ${{ secrets.AZURE_ENDPOINT }} --trusted-signing-account ${{secrets.AZURE_CODE_SIGNING_NAME}} --trusted-signing-certificate-profile ${{secrets.AZURE_CERT_PROFILE_NAME}}
67+
--base-directory "${{ github.workspace }}/BuildArtifacts"
68+
69+
# Publish the signed packages
70+
- name: Upload build artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: BuildArtifacts
74+
path: SignedArtifacts

src/Org.Openfeed.Client/Org.Openfeed.Client.csproj

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,4 @@
4646
<PackagePath></PackagePath>
4747
</None>
4848
</ItemGroup>
49-
50-
<PropertyGroup>
51-
<TargetsTriggeredByCompilation>Sign</TargetsTriggeredByCompilation>
52-
</PropertyGroup>
53-
54-
<Target Name="Sign" Condition="'$(Configuration)' == 'Publish'">
55-
<SignFile CertificateThumbprint="$(CertificateThumbprint)" SigningTarget="@(IntermediateAssembly)" TimestampUrl="$(TimestampUrl)" />
56-
</Target>
57-
58-
<Target Name="SignAfterPack" DependsOnTargets="Pack" Condition="'$(Configuration)' == 'Publish'">
59-
<Exec Command="nuget sign $(OutputPath)..\$(PackageId).$(PackageVersion).nupkg -CertificateFingerprint $(CertificateThumbprint) -Timestamper $(TimestampUrl)" />
60-
<Exec Command="nuget sign $(OutputPath)..\$(PackageId).$(PackageVersion).snupkg -CertificateFingerprint $(CertificateThumbprint) -Timestamper $(TimestampUrl)" />
61-
</Target>
62-
63-
<Target Name="PublishToNuGet" DependsOnTargets="SignAfterPack" Condition="'$(Configuration)' == 'Publish'">
64-
<Exec Command="nuget push $(OutputPath)..\$(PackageId).$(PackageVersion).nupkg -ApiKey $(NuGetApiKey) -Source https://api.nuget.org/v3/index.json" />
65-
</Target>
6649
</Project>

0 commit comments

Comments
 (0)