Skip to content

Commit de27f30

Browse files
committed
Initial addition of CI
1 parent f7e676a commit de27f30

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/cd-controls.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (c) 2024 Files Community
2+
# Licensed under the MIT License. See the LICENSE.
3+
4+
# Abstract:
5+
# Deploys the Files UI Controls library to NuGet
6+
#
7+
# Workflow:
8+
# 1. Restore and build Files UI Controls
9+
# 2. Generate a NuGet package and symbols
10+
# 3. Publish the artifacts to NuGet
11+
12+
name: Files CD (UI Controls)
13+
14+
on:
15+
push:
16+
branches:
17+
- main
18+
workflow_dispatch:
19+
20+
jobs:
21+
build:
22+
runs-on: windows-latest
23+
environment: Deployments
24+
strategy:
25+
fail-fast: false
26+
env:
27+
SOLUTION_NAME: 'Files.sln'
28+
CONFIGURATION: 'Release' # It's not necessary to use a matrix as the package method will always be Release
29+
WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\
30+
PROJECT_DIR: '${{ github.workspace }}\src\Files.App.Controls'
31+
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App.Controls\Files.App.Controls.csproj'
32+
33+
steps:
34+
- name: Checkout the repository
35+
uses: actions/checkout@v4
36+
- name: Setup MSBuild
37+
uses: microsoft/setup-msbuild@v2
38+
- name: Setup NuGet
39+
uses: NuGet/setup-nuget@v2
40+
- name: Setup .NET 8
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
global-json-file: global.json
44+
45+
- name: Use Windows SDK Preview
46+
shell: cmd
47+
run: |
48+
for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt
49+
50+
- name: Extract Version from Package.appxmanifest
51+
id: extract_version
52+
shell: pwsh
53+
run: |
54+
$xml = [xml](Get-Content Package.appxmanifest)
55+
$version = $xml.Package.Identity.Version
56+
Write-Output "Found package version, $version"
57+
echo "::set-output name=version::$version"
58+
59+
- name: Restore NuGet
60+
shell: pwsh
61+
run: 'dotnet restore $env:PACKAGE_PROJECT_PATH'
62+
63+
- name: Build Files UI Controls
64+
run: dotnet build ${{ matrix.project }}.csproj --configuration Release --no-restore
65+
66+
- name: Package Files UI Controls
67+
run: dotnet pack ${{ PACKAGE_PROJECT_PATH }}.csproj --configuration Release --no-build -o ./output -p:Version=${{ steps.extract_version.outputs.version }}
68+
69+
- name: Publish package to NuGet
70+
run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)