Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet: Added metadata to the Controls project to enable publishing to NuGet #16611

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/cd-controls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
34 changes: 34 additions & 0 deletions src/Files.App.Controls/Files.App.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,33 @@
<Optimize Condition="'$(Configuration)' != 'Debug'">true</Optimize>
</PropertyGroup>

<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>Files UI Controls</Title>
<Authors>files-community</Authors>
<Company>Files Community</Company>
<Copyright>Copyright (c) 2024 Files Community</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/files-community/Files</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>files, files-community</PackageTags>
Lamparter marked this conversation as resolved.
Show resolved Hide resolved
<Description>Elevate your WinUI applications with our collection of custom-built controls, crafted specifically to address our needs in Files. These controls are provided "as is," with no guaranteed support, but we hope they prove useful to the developer community.</Description>
Lamparter marked this conversation as resolved.
Show resolved Hide resolved
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<!--Version>{version}</Version>-->
<PackageProjectUrl>https://files.community</PackageProjectUrl>
<PackageIcon>StoreLogo.scale-400.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
<None Include="..\Files.App (Package)\Assets\AppTiles\Release\StoreLogo.scale-400.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.241107002" />
Expand All @@ -26,4 +53,11 @@
<ProjectReference Include="..\Files.Core.SourceGenerator\Files.Core.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions src/Files.App.Controls/README.md
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
> These controls are provided "as is," with no guaranteed support, but we hope they prove useful to the developer community.
Lamparter marked this conversation as resolved.
Show resolved Hide resolved

# 📁 Files UI Controls

##### Elevate your WinUI applications with our collection of custom-built controls, crafted specifically to address our needs in Files.

---

This package contains various controls for the [Files app](https://files.community), including `ThemedIcon`, `Toolbar` and various storage controls.
It is available [on NuGet](https://www.nuget.org/packages/Files.App.Controls), however is unlisted and can only be installed by manually typing the package name and version number into the MSBuild project file.

Please do not open issues on the Files repository about this package, as it is not officially supported by the Files team and is kept online for reference.
If you have questions about the design or implementation of these controls, please ask [on Discord](https://discord.gg/files).
Loading