-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
82 lines (71 loc) · 2.69 KB
/
cd-controls.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
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.
# Abstract:
# Deploys the Files UI Controls library to NuGet
#
# Workflow:
# 1. Restore and build Files UI Controls
# 2. Generate a NuGet package and symbols
# 3. Publish the artifacts to NuGet
name: Files CD (UI Controls)
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest
#environment: Deployments
strategy:
fail-fast: false
env:
SOLUTION_NAME: 'Files.sln'
CONFIGURATION: 'Release' # It's not necessary to use a matrix as the package method will always be Release
PLATFORM: 'x64'
WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\
PROJECT_DIR: '${{ github.workspace }}\src\Files.App.Controls'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App.Controls\Files.App.Controls.csproj'
PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App (Package)\Package.appxmanifest'
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Use Windows SDK Preview
shell: cmd
run: |
for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt
- name: Extract Version from Package.appxmanifest
id: extract_version
shell: pwsh
run: |
$xml = [xml](Get-Content $env:PACKAGE_MANIFEST_PATH)
$version = $xml.Package.Identity.Version
Write-Output "Found package version, $version"
echo "::set-output name=version::$version"
- name: Restore NuGet
shell: pwsh
run: |
msbuild $env:PACKAGE_PROJECT_PATH `
-t:Restore `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION `
- name: Build Files UI Controls
run: |
msbuild "$env:PACKAGE_PROJECT_PATH" `
-t:Build `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION
- name: Package Files UI Controls
run: dotnet pack ${{ env.PACKAGE_PROJECT_PATH }} --configuration Release --no-build -o ./output -p:Version=${{ steps.extract_version.outputs.version }}
- name: Publish package to NuGet
run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json