-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (99 loc) · 3.55 KB
/
packages.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Packages
on:
release:
types: [released]
push:
branches: [ master, main, release/* ]
pull_request:
branches: [ master, main ]
workflow_dispatch:
jobs:
prepare:
runs-on: windows-2022
env:
ARTIFACT_FOLDER: "${{ github.workspace }}/nuget"
outputs:
VERSION: "${{ steps.version.VERSION }}"
steps:
- name: Event
env:
event_name: ${{ github.event_name }}
run: echo "event_name $env:event_name"
- name: Checkout
uses: actions/checkout@v1
# - name: Setup .NET
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: 6.0.x
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@master
with:
vs-prerelease: true
vs-version: 17
- name: Setup GitVersion
run: |
dotnet tool install gitversion.tool -g
dotnet-gitversion
- name: Restore dependencies
run: msbuild /t:restore
- name: Build Debug
run: msbuild /t:build /p:Configuration=Debug /p:PackageOutputPath="${{ env.ARTIFACT_FOLDER }}" /p:IncludeSource=true src/CommunityToolkit.Extensions.Hosting.WindowsAppSdk/CommunityToolkit.Extensions.Hosting.WindowsAppSdk.csproj
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: artifacts
path: ${{ env.ARTIFACT_FOLDER }}
publish-to-github:
runs-on: windows-2022
if: ${{ github.event_name != 'release' }}
needs: prepare
env:
ARTIFACT_FOLDER: "${{ github.workspace }}/nuget"
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup GitVersion
run: dotnet tool install gitversion.tool -g
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: artifacts
path: ${{ env.ARTIFACT_FOLDER }}
- run: dir ${{ env.ARTIFACT_FOLDER }} -recurse
- name: Nuget Publish
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$NugetVersionV2=& dotnet-gitversion . /showvariable NuGetVersionV2
$githubUrl="https://nuget.pkg.github.com/OWNER/index.json"
& dotnet nuget add source --username sharpninja --password $env:TOKEN --store-password-in-clear-text --name github $githubUrl
$nupkgs = GCI SharpNinja.Extensions.WindowsAppSdkHost.${NuGetVersionV2}.symbols.nupkg -Path $env:ARTIFACT_FOLDER -ErrorAction Stop -Verbose
$nupkgs | foreach-object -Verbose -process { `
& dotnet nuget push "$_" -k "$env:TOKEN" --source github --skip-duplicate
}
publish-to-nuget:
runs-on: windows-2022
if: ${{ github.event_name == 'release' }}
needs: prepare
env:
ARTIFACT_FOLDER: "${{ github.workspace }}/nuget"
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup GitVersion
run: dotnet tool install gitversion.tool -g
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: artifacts
path: ${{ env.ARTIFACT_FOLDER }}
- run: dir ${{ env.ARTIFACT_FOLDER }} -recurse
- name: Nuget Publish
env:
nuget_token: ${{ secrets.NUGET_TOKEN }}
run: |
$NugetVersionV2=& dotnet-gitversion . /showvariable NuGetVersionV2
$nupkgs = GCI SharpNinja.Extensions.WindowsAppSdkHost.${NuGetVersionV2}.symbols.nupkg -Path $env:ARTIFACT_FOLDER -ErrorAction Stop -Verbose
$nupkgs | foreach-object -Verbose -process { `
& dotnet nuget push "$_" -k "$env:NUGET_TOKEN" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
}