Skip to content

Commit 3d08492

Browse files
committed
Init
1 parent 27c937a commit 3d08492

File tree

12 files changed

+485
-347
lines changed

12 files changed

+485
-347
lines changed

.github/scripts/Configure-AppxManifest.ps1

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ param(
1414
[xml]$xmlDoc = Get-Content $PackageManifestPath
1515
$xmlDoc.Package.Identity.Publisher = $Publisher
1616

17-
if ($Branch -eq "Preview")
17+
if ($Branch -eq "Sideload_Preview")
1818
{
1919
# Set identities
2020
$xmlDoc.Package.Identity.Name="FilesPreview"
@@ -29,7 +29,7 @@ if ($Branch -eq "Preview")
2929
Set-Content $_ -NoNewline `
3030
}
3131
}
32-
elseif ($Branch -eq "Stable")
32+
elseif ($Branch -eq "Sideload_Stable")
3333
{
3434
# Set identities
3535
$xmlDoc.Package.Identity.Name="Files"
@@ -44,7 +44,7 @@ elseif ($Branch -eq "Stable")
4444
Set-Content $_ -NoNewline `
4545
}
4646
}
47-
elseif ($Branch -eq "Store")
47+
elseif ($Branch -eq "Store_Stable")
4848
{
4949
# Set identities
5050
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesUWP"
@@ -66,6 +66,28 @@ elseif ($Branch -eq "Store")
6666
Set-Content $_ -NoNewline `
6767
}
6868
}
69+
elseif ($Branch -eq "Store_Preview")
70+
{
71+
# Set identities
72+
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesPreview"
73+
$xmlDoc.Package.Properties.DisplayName="Files - Preview"
74+
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview"
75+
$xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName="49306atecsolution.FilesPreview"
76+
77+
# Remove an capability that is used for the sideload
78+
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable)
79+
$nsmgr.AddNamespace("pkg", "http://schemas.microsoft.com/appx/manifest/foundation/windows10")
80+
$nsmgr.AddNamespace("rescap", "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities")
81+
$pm = $xmlDoc.SelectSingleNode("/pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']", $nsmgr)
82+
$xmlDoc.Package.Capabilities.RemoveChild($pm)
83+
$xmlDoc.Save($PackageManifestPath)
84+
85+
Get-ChildItem $WorkingDir -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach-Object -Process `
86+
{ `
87+
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) | `
88+
Set-Content $_ -NoNewline `
89+
}
90+
}
6991

7092
Get-ChildItem $WorkingDir -Include *.cs -recurse | ForEach-Object -Process `
7193
{ `

.github/workflows/cd-preview.yml renamed to .github/workflows/cd-sideload-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# 4. Sign the package
1212
# 5. Publish the package to Azure
1313

14-
name: Files CD (Preview)
14+
name: Files CD (Sideload Preview)
1515

1616
on:
1717
workflow_dispatch:
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
configuration: [Preview]
26+
configuration: [Sideload_Preview]
2727
platform: [x64]
2828
env:
2929
SOLUTION_NAME: 'Files.sln'

.github/workflows/cd-stable.yml renamed to .github/workflows/cd-sideload-stable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# 4. Sign the package
1212
# 5. Publish the package to Azure
1313

14-
name: Files CD (Stable)
14+
name: Files CD (Sideload Stable)
1515

1616
on:
1717
workflow_dispatch:
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
configuration: [Stable]
26+
configuration: [Sideload_Stable]
2727
platform: [x64]
2828
env:
2929
SOLUTION_NAME: 'Files.sln'
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Copyright (c) 2024 Files Community
2+
# Licensed under the MIT License. See the LICENSE.
3+
4+
# Abstract:
5+
# Deploys Files Preview (Store).
6+
#
7+
# Workflow:
8+
# 1. Configure manifest, logo and secrets
9+
# 2. Restore, build and package Files
10+
# 3. Generate a msixupload file
11+
# 4. Publish the msixupload to GitHub Actions
12+
13+
name: Files CD (Store Preview)
14+
15+
on:
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
runs-on: windows-latest
21+
environment: Deployments
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
configuration: [Store_Preview]
26+
platform: [x64]
27+
env:
28+
SOLUTION_NAME: 'Files.sln'
29+
CONFIGURATION: '${{ matrix.configuration }}'
30+
PLATFORM: '${{ matrix.platform }}'
31+
APPX_BUNDLE_PLATFORMS: 'x64|arm64'
32+
WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\
33+
ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts'
34+
APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages'
35+
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\Files.App (Package)'
36+
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App (Package)\Files.Package.wapproj'
37+
PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App (Package)\Package.appxmanifest'
38+
39+
steps:
40+
- name: Checkout the repository
41+
uses: actions/checkout@v4
42+
- name: Setup MSBuild
43+
uses: microsoft/setup-msbuild@v2
44+
- name: Setup NuGet
45+
uses: NuGet/setup-nuget@v2
46+
- name: Setup .NET 8
47+
uses: actions/setup-dotnet@v4
48+
with:
49+
global-json-file: global.json
50+
51+
- name: Configure the package manifest, logo, and secrets
52+
shell: pwsh
53+
run: |
54+
. './.github/scripts/Configure-AppxManifest.ps1' `
55+
-Branch "$env:CONFIGURATION" `
56+
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
57+
-Publisher "$env:STORE_PUBLISHER_SECRET" `
58+
-WorkingDir "$env:WORKING_DIR" `
59+
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
60+
-SecretSentry "$env:SECRET_SENTRY" `
61+
-SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID"
62+
env:
63+
STORE_PUBLISHER_SECRET: ${{ secrets.STORE_PUBLISHER_SECRET }}
64+
SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }}
65+
SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }}
66+
SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}
67+
68+
- name: Use Windows SDK Preview
69+
shell: cmd
70+
run: |
71+
for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt
72+
73+
- name: Restore NuGet
74+
shell: pwsh
75+
run: 'nuget restore $env:SOLUTION_NAME'
76+
77+
- name: Restore Files
78+
shell: pwsh
79+
run: |
80+
msbuild $env:SOLUTION_NAME `
81+
-t:Restore `
82+
-p:Platform=$env:PLATFORM `
83+
-p:Configuration=$env:CONFIGURATION `
84+
-p:PublishReadyToRun=true
85+
86+
- name: Build & package Files
87+
shell: pwsh
88+
run: |
89+
msbuild "$env:PACKAGE_PROJECT_PATH" `
90+
-t:Build `
91+
-t:_GenerateAppxPackage `
92+
-p:Platform=$env:PLATFORM `
93+
-p:Configuration=$env:CONFIGURATION `
94+
-p:AppxBundlePlatforms=$env:APPX_BUNDLE_PLATFORMS `
95+
-p:AppxPackageDir="$env:APPX_PACKAGE_DIR" `
96+
-p:AppxBundle=Always `
97+
-p:UapAppxPackageBuildMode=StoreUpload
98+
99+
- name: Remove empty files from the packages
100+
shell: bash
101+
run: find $ARTIFACTS_STAGING_DIR -empty -delete
102+
103+
- name: Upload the packages to GitHub Actions
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PLATFORM }})'
107+
path: ${{ env.ARTIFACTS_STAGING_DIR }}

.github/workflows/cd-store.yml renamed to .github/workflows/cd-store-stable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# 3. Generate a msixupload file
1111
# 4. Publish the msixupload to GitHub Actions
1212

13-
name: Files CD (Store)
13+
name: Files CD (Store Stable)
1414

1515
on:
1616
workflow_dispatch:
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
configuration: [Store]
25+
configuration: [Store_Stable]
2626
platform: [x64]
2727
env:
2828
SOLUTION_NAME: 'Files.sln'

0 commit comments

Comments
 (0)