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
44 changes: 28 additions & 16 deletions .github/workflows/cd-preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.

# Abstract:
# Deploys Files Preview (Sideload).
#
# Workflow:
# 1. Configure manifest, logo and secrets
# 2. Restore, build and package Files
# 3. Publish the appinstaller to files.community
# 4. Sign the package
# 5. Publish the package to Azure

name: Files CD (Preview)

on:
Expand All @@ -16,16 +26,18 @@ jobs:
configuration: [Preview]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
PACKAGE_PROJECT_DIR: 'src\Files.App (Package)'
PACKAGE_PROJECT_PATH: 'src\Files.App (Package)\Files.Package.wapproj'
TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj'
CONFIGURATION: ${{ matrix.configuration }}
PLATFORM: ${{ matrix.platform }}
APPX_BUNDLE_PLATFORMS: 'x64|arm64'
WORKING_DIR: ${{ github.workspace }} # Default: D:\a\Files\Files\
ARTIFACTS_STAGING_DIR: ${{ github.workspace }}\artifacts
APPX_PACKAGE_DIR: ${{ github.workspace }}\artifacts\AppxPackages
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: 'artifacts' # D:\a\Files\Files\artifacts\
APPX_PACKAGE_DIR: 'artifacts\AppxPackages'
PACKAGE_PROJECT_DIR: 'src\Files.App (Package)'
PACKAGE_PROJECT_PATH: 'src\Files.App (Package)\Files.Package.wapproj'
PACKAGE_MANIFEST_PATH: 'src\Files.App (Package)\Package.appxmanifest'
TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj'
APP_INSTALLER_SIDELOAD_URL: 'https://cdn.files.community/files/preview/'

steps:
- name: Checkout the repository
Expand All @@ -39,12 +51,12 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Configure the package manifest, logo sets, and secrets
- name: Configure the package manifest, logo, and secrets
shell: pwsh
run: |
. './scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-PackageProjectDir "$env:PACKAGE_PROJECT_DIR" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
Expand All @@ -65,7 +77,7 @@ jobs:
shell: pwsh
run: 'nuget restore $env:SOLUTION_NAME'

- name: Restore ${{ env.SOLUTION_NAME }}
- name: Restore Files
shell: pwsh
run: |
msbuild $env:SOLUTION_NAME `
Expand All @@ -74,7 +86,7 @@ jobs:
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true

- name: Build ${{ env.SOLUTION_NAME }}
- name: Build & package Files
shell: pwsh
run: |
msbuild "$env:PACKAGE_PROJECT_PATH" `
Expand All @@ -87,7 +99,7 @@ jobs:
-p:AppxBundle=Always `
-p:UapAppxPackageBuildMode=Sideload `
-p:GenerateAppInstallerFile=True `
-p:AppInstallerUri=https://cdn.files.community/files/preview/
-p:AppInstallerUri=$env:APP_INSTALLER_SIDELOAD_URL

- name: Remove empty files from the packages
shell: bash
Expand All @@ -101,7 +113,7 @@ jobs:
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath

- name: Sign files with Azure Trusted Signing
- name: Sign Files with Azure Trusted Signing
uses: azure/trusted-signing-action@v0.3.16
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
48 changes: 30 additions & 18 deletions .github/workflows/cd-stable.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.

# Abstract:
# Deploys Files (Sideload).
#
# Workflow:
# 1. Configure manifest, logo and secrets
# 2. Restore, build and package Files
# 3. Publish the appinstaller to files.community
# 4. Sign the package
# 5. Publish the package to Azure

name: Files CD (Stable)

on:
Expand All @@ -16,16 +26,18 @@ jobs:
configuration: [Stable]
platform: [x64]
env:
SOLUTION_NAME: 'Files.sln'
PACKAGE_PROJECT_DIR: 'src\Files.App (Package)'
PACKAGE_PROJECT_PATH: 'src\Files.App (Package)\Files.Package.wapproj'
TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj'
CONFIGURATION: ${{ matrix.configuration }}
PLATFORM: ${{ matrix.platform }}
APPX_BUNDLE_PLATFORMS: 'x64|arm64'
WORKING_DIR: ${{ github.workspace }} # Default: D:\a\Files\Files\
ARTIFACTS_STAGING_DIR: ${{ github.workspace }}\artifacts
APPX_PACKAGE_DIR: ${{ github.workspace }}\artifacts\AppxPackages
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: 'artifacts' # D:\a\Files\Files\artifacts\
APPX_PACKAGE_DIR: 'artifacts\AppxPackages'
PACKAGE_PROJECT_DIR: 'src\Files.App (Package)'
PACKAGE_PROJECT_PATH: 'src\Files.App (Package)\Files.Package.wapproj'
PACKAGE_MANIFEST_PATH: 'src\Files.App (Package)\Package.appxmanifest'
TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj'
APP_INSTALLER_SIDELOAD_URL: 'https://cdn.files.community/files/stable/'

steps:
- name: Checkout the repository
Expand All @@ -39,12 +51,12 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Configure the package manifest, logo sets, and secrets
- name: Configure the package manifest, logo, and secrets
shell: pwsh
run: |
. './scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-PackageProjectDir "$env:PACKAGE_PROJECT_DIR" `
-PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
Expand All @@ -65,7 +77,7 @@ jobs:
shell: pwsh
run: 'nuget restore $env:SOLUTION_NAME'

- name: Restore ${{ env.SOLUTION_NAME }}
- name: Restore Files
shell: pwsh
run: |
msbuild $env:SOLUTION_NAME `
Expand All @@ -74,7 +86,7 @@ jobs:
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true

- name: Build ${{ env.SOLUTION_NAME }}
- name: Build & package Files
shell: pwsh
run: |
msbuild "$env:PACKAGE_PROJECT_PATH" `
Expand All @@ -87,7 +99,7 @@ jobs:
-p:AppxBundle=Always `
-p:UapAppxPackageBuildMode=Sideload `
-p:GenerateAppInstallerFile=True `
-p:AppInstallerUri=https://cdn.files.community/files/stable/
-p:AppInstallerUri=$env:APP_INSTALLER_SIDELOAD_URL

- name: Remove empty files from the packages
shell: bash
Expand All @@ -101,7 +113,7 @@ jobs:
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath

- name: Sign files with Azure Trusted Signing
- name: Sign Files with Azure Trusted Signing
uses: azure/trusted-signing-action@v0.3.16
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -121,13 +133,13 @@ jobs:
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Upload to Azure blob storage
uses: azure/powershell@v1
with:
inlineScript: |
az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "stable" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true
az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "stable" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true
azPSVersion: "latest"

- name: Logout from Azure
Expand Down
52 changes: 26 additions & 26 deletions scripts/Configure-AppxManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

param(
[string]$Branch = "",
[string]$PackageProjectDir = "",
[string]$PackageManifestPath = "",
[string]$Publisher = "",
[string]$WorkingDir = "",
[string]$SecretBingMapsKey = "",
[string]$SecretSentry = "",
[string]$SecretGitHubOAuthClientId = ""
)

[xml]$xmlDoc = Get-Content "$PackageProjectDir\Package.appxmanifest"
[xml]$xmlDoc = Get-Content "$PackageManifestPath"
$xmlDoc.Package.Identity.Publisher="$Publisher"

if ($Branch -eq "Preview")
Expand All @@ -21,10 +21,10 @@ if ($Branch -eq "Preview")
$xmlDoc.Package.Properties.DisplayName="Files - Preview"
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview"

Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process
{
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) |
Set-Content $_ -NoNewline
Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process `
{ `
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) | `
Set-Content $_ -NoNewline `
}
}
elseif ($Branch -eq "Stable")
Expand All @@ -34,10 +34,10 @@ elseif ($Branch -eq "Stable")
$xmlDoc.Package.Properties.DisplayName="Files"
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files"

Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process
{
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Release" }) |
Set-Content $_ -NoNewline
Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process `
{ `
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Release" }) | `
Set-Content $_ -NoNewline `
}
}
elseif ($Branch -eq "Store")
Expand All @@ -54,29 +54,29 @@ elseif ($Branch -eq "Store")
$pm = $xmlDoc.SelectSingleNode("/pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']", $nsmgr)
$xmlDoc.Package.Capabilities.RemoveChild($pm)

Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process
{
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Release" }) |
Set-Content $_ -NoNewline
Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process `
{ `
(Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Release" }) | `
Set-Content $_ -NoNewline `
}
}

$xmlDoc.Save("$PackageProjectDir\Package.appxmanifest")
$xmlDoc.Save("$PackageManifestPath")

Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process
{
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "bingmapskey.secret", "$SecretBingMapsKey" }) |
Set-Content $_ -NoNewline
Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process `
{ `
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "bingmapskey.secret", "$SecretBingMapsKey" }) | `
Set-Content $_ -NoNewline `
}

Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process
Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process `
{
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "sentry.secret", "$SecretSentry" }) |
Set-Content $_ -NoNewline
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "sentry.secret", "$SecretSentry" }) | `
Set-Content $_ -NoNewline `
}

Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process
{
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "githubclientid.secret", "$SecretGitHubOAuthClientId" }) |
Set-Content $_ -NoNewline
Get-ChildItem "$WorkingDir\src" -Include *.cs -recurse | ForEach-Object -Process `
{ `
(Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "githubclientid.secret", "$SecretGitHubOAuthClientId" }) | `
Set-Content $_ -NoNewline `
}