-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (62 loc) · 2.64 KB
/
Copy pathmain.yml
File metadata and controls
75 lines (62 loc) · 2.64 KB
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
name: push_nuget
on:
push:
# branches: ["develop"]
tags: ["v*"]
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x.x"
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Build packages
run: |
dotnet build .\VL.Avalonia\src\VL.Avalonia.csproj --configuration Release --output .\VL.Avalonia\lib\net8.0\
dotnet build .\VL.Avalonia.Skia\src\VL.Avalonia.Skia.csproj --configuration Release --output .\VL.Avalonia.Skia\lib\net8.0\
dotnet build .\VL.Avalonia.Stride\src\VL.Avalonia.Stride.csproj --configuration Release --output .\VL.Avalonia.Stride\lib\net8.0\
dotnet build .\VL.Avalonia.Custom\src\VL.Avalonia.Custom.csproj --configuration Release --output .\VL.Avalonia.Custom\lib\net8.0\
- name: Extract version and detect pre-release
id: version
run: |
$version = "${{ github.ref_name }}"
$cleanVersion = $version.Substring(1)
$isPrerelease = $cleanVersion -match "[\-+]"
$prerelease = ""
if ($isPrerelease -eq "True"){
$prerelease = "--prerelease"
}
echo "VERSION=$cleanVersion" >> $env:GITHUB_ENV
echo "IS_PRERELEASE=$isPrerelease" >> $env:GITHUB_ENV
echo "PRERELEASE_STRING=$prerelease" >> $env:GITHUB_ENV
- name: Pack packages
run: |
nuget pack .nuget\VL.Avalonia.nuspec -Version ${{ env.VERSION }} -OutputDirectory .\packages
nuget pack .nuget\VL.Avalonia.Skia.nuspec -Version ${{ env.VERSION }} -OutputDirectory .\packages
nuget pack .nuget\VL.Avalonia.Custom.nuspec -Version ${{ env.VERSION }} -OutputDirectory .\packages
nuget pack .nuget\VL.Avalonia.Stride.nuspec -Version ${{ env.VERSION }} -OutputDirectory .\packages
- name: Publish to NuGet.org
run: |
Write-Host "Publishing to NuGet.org..."
foreach ($package in Get-ChildItem -Path ./packages -Filter *.nupkg) {
dotnet nuget push $package `
--api-key ${{ secrets.NUGET_KEY }} `
--source https://api.nuget.org/v3/index.json `
--skip-duplicate `
${{ env.PRERELEASE_STRING}}
}
- name: Upload artifacts
uses: ncipollo/release-action@v1
with:
artifacts: packages/**
generateReleaseNotes: true
allowUpdates: true
prerelease: ${{ env.IS_PRERELEASE == 'True' }}