Skip to content

Commit 4dfbaed

Browse files
authored
housekeeping: Enable release build
1 parent b47b28b commit 4dfbaed

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
env:
8+
configuration: Release
9+
productNamespacePrefix: "ReactiveMarbles"
10+
11+
jobs:
12+
release:
13+
runs-on: windows-2022
14+
environment:
15+
name: release
16+
outputs:
17+
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2.3.4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install .NET Core
25+
uses: actions/setup-dotnet@v1.8.2
26+
with:
27+
dotnet-version: 3.1.x
28+
29+
- name: Install .NET 5
30+
uses: actions/setup-dotnet@v1.8.2
31+
with:
32+
dotnet-version: 5.0.x
33+
34+
- name: Install .NET 6
35+
uses: actions/setup-dotnet@v1.8.2
36+
with:
37+
dotnet-version: 6.0.x
38+
include-prerelease: true
39+
40+
- name: NBGV
41+
id: nbgv
42+
uses: dotnet/nbgv@master
43+
with:
44+
setAllVars: true
45+
46+
- name: NuGet Restore
47+
run: dotnet restore
48+
working-directory: src
49+
50+
- name: Build
51+
run: dotnet build --configuration=${{ env.configuration }} --verbosity=minimal --no-restore
52+
working-directory: src
53+
54+
- uses: nuget/setup-nuget@v1
55+
name: Setup NuGet
56+
57+
- name: Pack
58+
run: dotnet pack --configuration=${{ env.configuration }} --verbosity=minimal --no-restore
59+
working-directory: src
60+
61+
# Decode the base 64 encoded pfx and save the Signing_Certificate
62+
- name: Sign NuGet packages
63+
shell: pwsh
64+
run: |
65+
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.SIGNING_CERTIFICATE }}")
66+
[IO.File]::WriteAllBytes("GitHubActionsWorkflow.pfx", $pfx_cert_byte)
67+
$secure_password = ConvertTo-SecureString ${{ secrets.SIGN_CERTIFICATE_PASSWORD }} –asplaintext –force
68+
Import-PfxCertificate -FilePath GitHubActionsWorkflow.pfx -Password $secure_password -CertStoreLocation Cert:\CurrentUser\My
69+
nuget sign -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SIGN_CERTIFICATE_HASH }} **/*.nupkg
70+
71+
- name: Changelog
72+
uses: glennawatson/ChangeLog@v1
73+
id: changelog
74+
75+
- name: Create Release
76+
uses: actions/create-release@v1.1.4
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
79+
with:
80+
tag_name: ${{ steps.nbgv.outputs.SemVer2 }}
81+
release_name: ${{ steps.nbgv.outputs.SemVer2 }}
82+
body: |
83+
${{ steps.changelog.outputs.commitLog }}
84+
85+
- name: NuGet Push
86+
env:
87+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
88+
SOURCE_URL: https://api.nuget.org/v3/index.json
89+
run: |
90+
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg

0 commit comments

Comments
 (0)