-
Notifications
You must be signed in to change notification settings - Fork 34
68 lines (60 loc) · 1.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build
on:
pull_request:
push:
release:
types: [published]
jobs:
build:
name: Build
env:
NUPKG_MAJOR: 0.999
CODESIGN_PFX: ${{ secrets.CODESIGN_PFX }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Setup MAUI
shell: pwsh
run: |
& dotnet workload install maui ios android maccatalyst
- name: Build
run: dotnet build --configuration Release
# - name: Test
# run: dotnet test --configuration Release
- name: Package NuGets
shell: pwsh
run: |
$VERSION="$env:NUPKG_MAJOR-ci$env:GITHUB_RUN_ID"
if ($env:GITHUB_EVENT_NAME -eq "release") {
$VERSION = $env:GITHUB_REF.Substring($env:GITHUB_REF.LastIndexOf('/') + 1)
}
echo "::set-output name=pkgverci::$VERSION"
echo "PACKAGE VERSION: $VERSION"
New-Item -ItemType Directory -Force -Path .\artifacts
dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=$VERSION ./VirtualListView/VirtualListView.csproj
$pfxPath = Join-Path -Path $pwd -ChildPath "codesigncert.pfx"
[IO.File]::WriteAllBytes("$pfxPath", [System.Convert]::FromBase64String($env:CODESIGN_PFX))
nuget sign .\artifacts\*.nupkg -CertificatePath $pfxPath -Timestamper http://timestamp.entrust.net/TSS/RFC3161sha2TS
- name: Artifacts
uses: actions/upload-artifact@v1
with:
name: NuGet
path: ./artifacts
publish:
name: Publish
needs: build
runs-on: windows-latest
if: github.event_name == 'release'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v1
with:
name: NuGet
- name: Push NuGet
run: |
dotnet nuget push NuGet\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }}