Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 37 additions & 4 deletions .github/scripts/Configure-AppxManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See the LICENSE.

param(
[string]$Branch = "",
[string]$Branch = "", # This has to correspond with one of the AppEnvironment enum values
[string]$PackageManifestPath = "",
[string]$Publisher = "",
[string]$WorkingDir = "",
Expand All @@ -27,7 +27,7 @@ $ea = $xmlDoc.SelectSingleNode("/pkg:Package/pkg:Applications/pkg:Application/pk
# Update the publisher
$xmlDoc.Package.Identity.Publisher = $Publisher

if ($Branch -eq "Preview")
if ($Branch -eq "SideloadPreview")
{
# Set identities
$xmlDoc.Package.Identity.Name="FilesPreview"
Expand All @@ -54,7 +54,34 @@ if ($Branch -eq "Preview")
Set-Content $_ -NoNewline `
}
}
elseif ($Branch -eq "Stable")
elseif ($Branch -eq "StorePreview")
{
# Set identities
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesPreview"
$xmlDoc.Package.Properties.DisplayName="Files - Preview"
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview"
$xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName="49306atecsolution.FilesPreview"

# Remove capability that is only used for the sideload package
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable)
$nsmgr.AddNamespace("pkg", "http://schemas.microsoft.com/appx/manifest/foundation/windows10")
$nsmgr.AddNamespace("rescap", "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities")
$pm = $xmlDoc.SelectSingleNode("/pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']", $nsmgr)
$xmlDoc.Package.Capabilities.RemoveChild($pm)

# Update app protocol and execution alias
$ap.SetAttribute("Name", "files-preview");
$ea.SetAttribute("Alias", "files-preview.exe");

$xmlDoc.Save($PackageManifestPath)

Get-ChildItem $WorkingDir -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach-Object -Process `
{ `
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) | `
Set-Content $_ -NoNewline `
}
}
elseif ($Branch -eq "SideloadStable")
{
# Set identities
$xmlDoc.Package.Identity.Name="Files"
Expand All @@ -81,7 +108,7 @@ elseif ($Branch -eq "Stable")
Set-Content $_ -NoNewline `
}
}
elseif ($Branch -eq "Store")
elseif ($Branch -eq "StoreStable")
{
# Set identities
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesUWP"
Expand Down Expand Up @@ -113,6 +140,12 @@ elseif ($Branch -eq "Store")
}
}

Get-ChildItem $WorkingDir -Include *.cs -recurse | ForEach-Object -Process `
{ `
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "cd_app_env_placeholder", $Branch }) | `
Set-Content $_ -NoNewline `
}

Get-ChildItem $WorkingDir -Include *.cs -recurse | ForEach-Object -Process `
{ `
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "bingmapskey.secret", "$SecretBingMapsKey" }) | `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 4. Sign the package
# 5. Publish the package to Azure

name: Files CD (Preview)
name: Files CD (Sideload Preview)

on:
workflow_dispatch:
Expand All @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
configuration: [Preview]
configuration: [Release]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
shell: pwsh
run: |
. './.github/scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-Branch "SideloadPreview" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 4. Sign the package
# 5. Publish the package to Azure

name: Files CD (Stable)
name: Files CD (Sideload Stable)

on:
workflow_dispatch:
Expand All @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
configuration: [Stable]
configuration: [Release]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
shell: pwsh
run: |
. './.github/scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-Branch "SideloadStable" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/cd-store-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.

# Abstract:
# Deploys Files Preview (Store).
#
# Workflow:
# 1. Configure manifest, logo and secrets
# 2. Restore, build and package Files
# 3. Generate a msixupload file
# 4. Publish the msixupload to GitHub Actions

name: Files CD (Store Preview)

on:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
environment: Deployments
strategy:
fail-fast: false
matrix:
configuration: [Release]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
CONFIGURATION: '${{ matrix.configuration }}'
PLATFORM: '${{ matrix.platform }}'
APPX_BUNDLE_PLATFORMS: 'x64|arm64'
WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\
ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts'
APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages'
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\Files.App (Package)'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App (Package)\Files.Package.wapproj'
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: Configure the package manifest, logo, and secrets
shell: pwsh
run: |
. './.github/scripts/Configure-AppxManifest.ps1' `
-Branch "StorePreview" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:STORE_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
-SecretSentry "$env:SECRET_SENTRY" `
-SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID"
env:
STORE_PUBLISHER_SECRET: ${{ secrets.STORE_PUBLISHER_SECRET }}
SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }}
SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }}
SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}

- 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: Restore NuGet
shell: pwsh
run: 'nuget restore $env:SOLUTION_NAME'

- name: Restore Files
shell: pwsh
run: |
msbuild $env:SOLUTION_NAME `
-t:Restore `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true
- name: Build & package Files
shell: pwsh
run: |
msbuild "$env:PACKAGE_PROJECT_PATH" `
-t:Build `
-t:_GenerateAppxPackage `
-p:Platform=$env:PLATFORM `
-p:Configuration=$env:CONFIGURATION `
-p:AppxBundlePlatforms=$env:APPX_BUNDLE_PLATFORMS `
-p:AppxPackageDir="$env:APPX_PACKAGE_DIR" `
-p:AppxBundle=Always `
-p:UapAppxPackageBuildMode=StoreUpload
- name: Remove empty files from the packages
shell: bash
run: find $ARTIFACTS_STAGING_DIR -empty -delete

- name: Upload the packages to GitHub Actions
uses: actions/upload-artifact@v4
with:
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PLATFORM }})'
path: ${{ env.ARTIFACTS_STAGING_DIR }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 3. Generate a msixupload file
# 4. Publish the msixupload to GitHub Actions

name: Files CD (Store)
name: Files CD (Store Stable)

on:
workflow_dispatch:
Expand All @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
configuration: [Store]
configuration: [Release]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
shell: pwsh
run: |
. './.github/scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-Branch "StoreStable" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:STORE_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
Expand Down
Loading
Loading