From e9b6623c1153b4e3ebea218ae290eea1f1996f04 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Sat, 9 Dec 2023 15:24:37 +0900 Subject: [PATCH 1/8] Update deploy-preview.yml --- .github/workflows/deploy-preview.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 1028fe158569..4edf96535d0f 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -1,10 +1,10 @@ -name: Deploy Preview Pipeline +name: Files Deployment on: workflow_dispatch: jobs: - build: + deploy: runs-on: windows-latest environment: Deployments strategy: From 75f8b8986b17744ddd22c045ed92abad59000958 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Sat, 9 Dec 2023 07:46:24 +0000 Subject: [PATCH 2/8] Update --- .../{deploy-preview.yml => deployment.yml} | 115 ++++++------ .github/workflows/production.yml | 168 ++++++++++++++++++ scripts/Configure-AppxManifest.ps1 | 58 ++++++ scripts/Replace-SpecialString.ps1 | 14 ++ 4 files changed, 305 insertions(+), 50 deletions(-) rename .github/workflows/{deploy-preview.yml => deployment.yml} (58%) create mode 100644 .github/workflows/production.yml create mode 100644 scripts/Configure-AppxManifest.ps1 create mode 100644 scripts/Replace-SpecialString.ps1 diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deployment.yml similarity index 58% rename from .github/workflows/deploy-preview.yml rename to .github/workflows/deployment.yml index 4edf96535d0f..e8d8b91f687c 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deployment.yml @@ -1,7 +1,48 @@ +# Copyright (c) 2023 Files Community +# Licensed under the MIT License. See the LICENSE. + +# Abstract: +# This workflow is executed manually when the owner of files-communnity decides +# to deploy preview or stable version. + name: Files Deployment on: + workflow_call: + inputs: + branch: + description: 'Select a branch' + required: false + default: 'Preview' + type: choice + options: + - Preview + - Stable workflow_dispatch: + inputs: + branch: + description: 'Select a branch' + required: false + default: 'Preview' + type: choice + options: + - Preview + - Stable + +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' + DEPLOY_BRANCH: ${{ workflow_dispatch.inputs.branch }} + CONFIGURATION: ${{ workflow_dispatch.inputs.branch }} + PLATFORM: 'x64' + 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 + +run-name: Files Deployment jobs: deploy: @@ -9,20 +50,6 @@ jobs: environment: Deployments strategy: fail-fast: false - matrix: - 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 steps: - name: Checkout the repository @@ -39,58 +66,46 @@ jobs: with: dotnet-version: '7.0.x' - # TODO: Move the command to PowerShell script instead - - name: Update Package.appxmanifest - shell: pwsh + - name: Set the branch environment variable run: | - [xml]$xmlDoc = Get-Content "$env:PACKAGE_PROJECT_DIR\Package.appxmanifest" - $xmlDoc.Package.Identity.Name="FilesPreview" - $xmlDoc.Package.Identity.Publisher="$env:SIDELOAD_PUBLISHER_SECRET" - $xmlDoc.Package.Properties.DisplayName="Files - Preview" - $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview" - $xmlDoc.Save("$env:PACKAGE_PROJECT_DIR\Package.appxmanifest") + if [[ "$WORKFLOW_DISPATCH_BRANCH" == "" ]]; then + echo "GITHUB_SHA_SHORT=$GITHUB_SHA" >> $DEPLOY_BRANCH ` + echo "GITHUB_SHA_SHORT=$GITHUB_SHA" >> $DEPLOY_BRANCH env: - SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} + WORKFLOW_DISPATCH_BRANCH: ${{ workflow_dispatch.inputs.branch }} + WORKFLOW_CALL_BRANCH: ${{ workflow_call.inputs.branch }} - # TODO: Move the command to PowerShell script instead - - name: Use the ${{ env.CONFIGURATION }} logo sets + - name: Configure the package manifest & logo sets shell: pwsh run: | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process ` - { ` - (Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) | ` - Set-Content $_ -NoNewline ` - } + . './scripts/Configure-AppxManifest.ps1' ` + -Branch "$env:DEPLOY_BRANCH" ` + -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` + -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" + env: + SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} - name: Inject the Bing Maps API token shell: pwsh run: | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` - { ` - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "bingmapskey.secret", "$env:BING_MAPS_SECRET" }) | ` - Set-Content $_ -NoNewline ` - } + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New: "$env:BING_MAPS_SECRET" env: BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} - name: Inject the AppCenter token shell: pwsh run: | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` - { ` - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "appcenter.secret", "$env:APP_CENTER_SECRET" }) | ` - Set-Content $_ -NoNewline ` - } + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New: "$env:APP_CENTER_SECRET" env: APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} - name: Inject the GitHub OAuth client ID run: | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` - { ` - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "githubclientid.secret", "$env:GH_OAUTH_CLIENT_ID" }) | ` - Set-Content $_ -NoNewline ` - } + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New: "$env:GH_OAUTH_CLIENT_ID" env: GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} @@ -148,19 +163,19 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - uses: azure/login@v1 + - name: Login to the Azure CLI + uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: Upload to blob storage + - name: Upload to the Azure Blob Storage uses: azure/powershell@v1 with: inlineScript: | az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true azPSVersion: "latest" - # Azure logout - - name: logout + - name: Logout from the Azure CLI run: | az logout diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml new file mode 100644 index 000000000000..142b04bec27d --- /dev/null +++ b/.github/workflows/production.yml @@ -0,0 +1,168 @@ +# Copyright (c) 2023 Files Community +# Licensed under the MIT License. See the LICENSE. + +# Abstract: +# ??? PREVIEW or STORE + +name: Files Production + +on: + workflow_dispatch: + +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: ${{ workflow_dispatch.inputs.branch }} + PLATFORM: 'x64' + 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 + +run-name: Files Production + +jobs: + deploy: + runs-on: windows-latest + strategy: + fail-fast: false + + steps: + - name: Deploy to the Azure Blob Storage + uses: files-community/Files/.github/workflows/deployment.yml@main + with: + branch: Stable + + sumbit: + runs-on: windows-latest + environment: Deployments + strategy: + fail-fast: false + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.1.1 + + - name: Setup .NET 7 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' + + - name: Configure the package manifest & logo sets + shell: pwsh + run: | + . './scripts/Configure-AppxManifest.ps1' ` + -Branch "$env:DEPLOY_BRANCH" ` + -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` + -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" + env: + DEPLOY_BRANCH: ${{ workflow_dispatch.inputs.branch }} + SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} + + - name: Inject the Bing Maps API token + shell: pwsh + run: | + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New: "$env:BING_MAPS_SECRET" + env: + BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} + + - name: Inject the AppCenter token + shell: pwsh + run: | + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New: "$env:APP_CENTER_SECRET" + env: + APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} + + - name: Inject the GitHub OAuth client ID + run: | + . './scripts/Configure-AppxManifest.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New: "$env:GH_OAUTH_CLIENT_ID" + env: + GH_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 ${{ env.SOLUTION_NAME }} + shell: pwsh + run: | + msbuild $env:SOLUTION_NAME ` + -t:Restore ` + -p:Platform=$env:PLATFORM ` + -p:Configuration=$env:CONFIGURATION ` + -p:PublishReadyToRun=true + + - name: Build ${{ env.SOLUTION_NAME }} + 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=Sideload ` + -p:GenerateAppInstallerFile=True ` + -p:AppInstallerUri=https://cdn.files.community/files/preview/ + + - name: Remove empty files from the packages + shell: bash + run: find $ARTIFACTS_STAGING_DIR -empty -delete + + - name: Sign files with Azure Code Signing + uses: azure/azure-code-signing-action@v0.2.21 + with: + azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} + azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} + azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} + endpoint: https://wus2.codesigning.azure.net/ + code-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }} + certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }} + files-folder: ${{ env.APPX_PACKAGE_DIR }} + files-folder-filter: msixbundle + files-folder-recurse: true + files-folder-depth: 4 + file-digest: SHA256 + timestamp-rfc3161: http://timestamp.acs.microsoft.com + timestamp-digest: SHA256 + + - name: Login to the Azure CLI + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Upload to the Azure Blob Storage + uses: azure/powershell@v1 + with: + inlineScript: | + az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true + azPSVersion: "latest" + + - name: Logout from the Azure CLI + run: | + az logout + + - name: Upload the packages to GitHub Actions + uses: actions/upload-artifact@v3 + with: + name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PLATFORM }})' + path: ${{ env.ARTIFACTS_STAGING_DIR }} diff --git a/scripts/Configure-AppxManifest.ps1 b/scripts/Configure-AppxManifest.ps1 new file mode 100644 index 000000000000..47ac0181c203 --- /dev/null +++ b/scripts/Configure-AppxManifest.ps1 @@ -0,0 +1,58 @@ +# Copyright (c) 2023 Files Community +# Licensed under the MIT License. See the LICENSE. + +param( + [string]$Branch = "", + [string]$PackageProjectDir = "" + [string]$Publisher = "Files" + [string]$WorkingDir = "" +) + +[xml]$xmlDoc = Get-Content "$PackageProjectDir\Package.appxmanifest" +$xmlDoc.Package.Identity.Publisher="$Publisher" + +if ($Branch -eq "Preview") +{ + $xmlDoc.Package.Identity.Name="FilesPreview" + $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 ` + } +} +elseif ($Branch -eq "Stable") +{ + $xmlDoc.Package.Identity.Name="Files" + $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 ` + } +} +elseif ($Branch -eq "Store") +{ + $xmlDoc.Package.Identity.Name="49306atecsolution.FilesUWP" + $xmlDoc.Package.Properties.DisplayName="Files" + $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files" + + # Remove an capability that is used for the sideload + $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) + + 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") diff --git a/scripts/Replace-SpecialString.ps1 b/scripts/Replace-SpecialString.ps1 new file mode 100644 index 000000000000..6a4670fded5e --- /dev/null +++ b/scripts/Replace-SpecialString.ps1 @@ -0,0 +1,14 @@ +# Copyright (c) 2023 Files Community +# Licensed under the MIT License. See the LICENSE. + +param( + [string]$WorkingDir = "" + [string]$Target = "", + [string]$New = "" +) + +Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process ` +{ ` + (Get-Content $_ -Raw | ForEach -Process { $_ -replace "$Target", "$New" }) | ` + Set-Content $_ -NoNewline ` +} From 64a6e14ce208e12faa4b6b04d63b9b5499d00c7e Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:37:41 +0000 Subject: [PATCH 3/8] Update --- .github/workflows/deployment.yml | 48 ++++++++------------- .github/workflows/production.yml | 73 +++++++++----------------------- 2 files changed, 39 insertions(+), 82 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index e8d8b91f687c..cfe188cb1357 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -2,8 +2,8 @@ # Licensed under the MIT License. See the LICENSE. # Abstract: -# This workflow is executed manually when the owner of files-communnity decides -# to deploy preview or stable version. +# This workflow is triggered manually when the maintainer wants +# to deploy Preview or Stable to the Azure Blob Storage. name: Files Deployment @@ -19,28 +19,18 @@ on: - Preview - Stable workflow_dispatch: - inputs: - branch: - description: 'Select a branch' - required: false - default: 'Preview' - type: choice - options: - - Preview - - Stable 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' - DEPLOY_BRANCH: ${{ workflow_dispatch.inputs.branch }} - CONFIGURATION: ${{ workflow_dispatch.inputs.branch }} PLATFORM: 'x64' 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 + PACKAGE_DEPLOYMENT_BRANCH: 'Preview' # NOTE: This is just placeholder run-name: Files Deployment @@ -66,7 +56,7 @@ jobs: with: dotnet-version: '7.0.x' - - name: Set the branch environment variable + - name: Set the correct value to PACKAGE_DEPLOYMENT_BRANCH run: | if [[ "$WORKFLOW_DISPATCH_BRANCH" == "" ]]; then echo "GITHUB_SHA_SHORT=$GITHUB_SHA" >> $DEPLOY_BRANCH ` @@ -81,31 +71,31 @@ jobs: . './scripts/Configure-AppxManifest.ps1' ` -Branch "$env:DEPLOY_BRANCH" ` -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` - -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -Publisher "$env:SIDELOAD_PUBLISHER" ` -WorkingDir "$env:WORKING_DIR" env: - SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} + SIDELOAD_PUBLISHER: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} - name: Inject the Bing Maps API token shell: pwsh run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New: "$env:BING_MAPS_SECRET" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New "$env:BING_MAPS_SECRET" env: BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} - name: Inject the AppCenter token shell: pwsh run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New: "$env:APP_CENTER_SECRET" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New "$env:APP_CENTER_SECRET" env: APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} - name: Inject the GitHub OAuth client ID run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New: "$env:GH_OAUTH_CLIENT_ID" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New "$env:GH_OAUTH_CLIENT_ID" env: GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} @@ -118,7 +108,7 @@ jobs: shell: pwsh run: 'nuget restore $env:SOLUTION_NAME' - - name: Restore ${{ env.SOLUTION_NAME }} + - name: Restore Files.sln shell: pwsh run: | msbuild $env:SOLUTION_NAME ` @@ -126,8 +116,10 @@ jobs: -p:Platform=$env:PLATFORM ` -p:Configuration=$env:CONFIGURATION ` -p:PublishReadyToRun=true + env: + CONFIGURATION: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} - - name: Build ${{ env.SOLUTION_NAME }} + - name: Build & package Files shell: pwsh run: | msbuild "$env:PACKAGE_PROJECT_PATH" ` @@ -141,6 +133,8 @@ jobs: -p:UapAppxPackageBuildMode=Sideload ` -p:GenerateAppInstallerFile=True ` -p:AppInstallerUri=https://cdn.files.community/files/preview/ + env: + CONFIGURATION: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} - name: Remove empty files from the packages shell: bash @@ -178,9 +172,3 @@ jobs: - name: Logout from the Azure CLI run: | az logout - - - name: Upload the packages to GitHub Actions - uses: actions/upload-artifact@v3 - with: - name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PLATFORM }})' - path: ${{ env.ARTIFACTS_STAGING_DIR }} diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 142b04bec27d..a7b0e13c47f4 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -2,7 +2,10 @@ # Licensed under the MIT License. See the LICENSE. # Abstract: -# ??? PREVIEW or STORE +# - This workflow is triggered manually when the maintainer wants publish +# a new submission to the Microsoft Store. +# - Before submitting to the MS Store, the workflow deploy the package to +# the Azure Blob Storage. name: Files Production @@ -20,10 +23,13 @@ env: WORKING_DIR: ${{ github.workspace }} # Default: D:\a\Files\Files\ ARTIFACTS_STAGING_DIR: ${{ github.workspace }}\artifacts APPX_PACKAGE_DIR: ${{ github.workspace }}\artifacts\AppxPackages + PACKAGE_DEPLOYMENT_BRANCH: 'Stable' + PACKAGE_SUBMISSION_BRANCH: 'Store' run-name: Files Production jobs: + # Deploy the package with Stable configured to the Azure Blob Storage deploy: runs-on: windows-latest strategy: @@ -33,8 +39,9 @@ jobs: - name: Deploy to the Azure Blob Storage uses: files-community/Files/.github/workflows/deployment.yml@main with: - branch: Stable + branch: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} + # Submit the package with Store configured to the Microsoft Store sumbit: runs-on: windows-latest environment: Deployments @@ -60,34 +67,33 @@ jobs: shell: pwsh run: | . './scripts/Configure-AppxManifest.ps1' ` - -Branch "$env:DEPLOY_BRANCH" ` + -Branch "$env:PACKAGE_SUBMISSION_BRANCH" ` -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` - -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -Publisher "$env:PRODUCTION_PUBLISHER" ` -WorkingDir "$env:WORKING_DIR" env: - DEPLOY_BRANCH: ${{ workflow_dispatch.inputs.branch }} - SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} + PRODUCTION_PUBLISHER: 'CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7' - name: Inject the Bing Maps API token shell: pwsh run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New: "$env:BING_MAPS_SECRET" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New "$env:BING_MAPS_SECRET" env: BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} - name: Inject the AppCenter token shell: pwsh run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New: "$env:APP_CENTER_SECRET" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New "$env:APP_CENTER_SECRET" env: APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} - name: Inject the GitHub OAuth client ID run: | - . './scripts/Configure-AppxManifest.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New: "$env:GH_OAUTH_CLIENT_ID" + . './scripts/Replace-SpecialString.ps1' ` + -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New "$env:GH_OAUTH_CLIENT_ID" env: GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} @@ -100,7 +106,7 @@ jobs: shell: pwsh run: 'nuget restore $env:SOLUTION_NAME' - - name: Restore ${{ env.SOLUTION_NAME }} + - name: Restore Files.sln shell: pwsh run: | msbuild $env:SOLUTION_NAME ` @@ -109,7 +115,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" ` @@ -128,41 +134,4 @@ jobs: shell: bash run: find $ARTIFACTS_STAGING_DIR -empty -delete - - name: Sign files with Azure Code Signing - uses: azure/azure-code-signing-action@v0.2.21 - with: - azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} - azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} - azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} - endpoint: https://wus2.codesigning.azure.net/ - code-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }} - certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }} - files-folder: ${{ env.APPX_PACKAGE_DIR }} - files-folder-filter: msixbundle - files-folder-recurse: true - files-folder-depth: 4 - file-digest: SHA256 - timestamp-rfc3161: http://timestamp.acs.microsoft.com - timestamp-digest: SHA256 - - - name: Login to the Azure CLI - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Upload to the Azure Blob Storage - uses: azure/powershell@v1 - with: - inlineScript: | - az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true - azPSVersion: "latest" - - - name: Logout from the Azure CLI - run: | - az logout - - - name: Upload the packages to GitHub Actions - uses: actions/upload-artifact@v3 - with: - name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PLATFORM }})' - path: ${{ env.ARTIFACTS_STAGING_DIR }} +## Create, update and publish submission \ No newline at end of file From 5f831cf0e36302f75cb5201a884958f734dca15b Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:45:14 +0000 Subject: [PATCH 4/8] Update --- .github/workflows/deployment.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index cfe188cb1357..22a7637608bf 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -25,6 +25,7 @@ env: 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: 'Preview' # NOTE: This is just placeholder PLATFORM: 'x64' APPX_BUNDLE_PLATFORMS: 'x64|arm64' WORKING_DIR: ${{ github.workspace }} # Default: D:\a\Files\Files\ @@ -57,19 +58,20 @@ jobs: dotnet-version: '7.0.x' - name: Set the correct value to PACKAGE_DEPLOYMENT_BRANCH + shel: pwsh run: | - if [[ "$WORKFLOW_DISPATCH_BRANCH" == "" ]]; then - echo "GITHUB_SHA_SHORT=$GITHUB_SHA" >> $DEPLOY_BRANCH ` - echo "GITHUB_SHA_SHORT=$GITHUB_SHA" >> $DEPLOY_BRANCH + if [[ "$WORKFLOW_EVENT_NAME" == "workflow_call" ]]; then + echo "$REQUESTED_BRANCH_NAME" >> $PACKAGE_DEPLOYMENT_BRANCH ` + echo "$REQUESTED_BRANCH_NAME" >> $CONFIGURATION env: - WORKFLOW_DISPATCH_BRANCH: ${{ workflow_dispatch.inputs.branch }} - WORKFLOW_CALL_BRANCH: ${{ workflow_call.inputs.branch }} + WORKFLOW_EVENT_NAME: ${{ github.event_name }} + REQUESTED_BRANCH_NAME: ${{ workflow_call.inputs.branch }} - name: Configure the package manifest & logo sets shell: pwsh run: | . './scripts/Configure-AppxManifest.ps1' ` - -Branch "$env:DEPLOY_BRANCH" ` + -Branch "$env:PACKAGE_DEPLOYMENT_BRANCH" ` -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` -Publisher "$env:SIDELOAD_PUBLISHER" ` -WorkingDir "$env:WORKING_DIR" @@ -116,8 +118,6 @@ jobs: -p:Platform=$env:PLATFORM ` -p:Configuration=$env:CONFIGURATION ` -p:PublishReadyToRun=true - env: - CONFIGURATION: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} - name: Build & package Files shell: pwsh @@ -132,9 +132,7 @@ jobs: -p:AppxBundle=Always ` -p:UapAppxPackageBuildMode=Sideload ` -p:GenerateAppInstallerFile=True ` - -p:AppInstallerUri=https://cdn.files.community/files/preview/ - env: - CONFIGURATION: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} + -p:AppInstallerUri=https://cdn.files.community/files/$env:PACKAGE_DEPLOYMENT_BRANCH/ - name: Remove empty files from the packages shell: bash From b8df0ad4d7a4ee79014843899c304356d7c07724 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:54:57 +0000 Subject: [PATCH 5/8] Update --- .github/workflows/ci.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ebcd698eb77..a72f271e2956 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,21 @@ on: push: branches: - main - paths-ignore: - - 'specs/**' - - '*.md' + paths: + - '**' + - '!.github/**' + - '.github/workflows/ci.yml' + - '!specs/**' + - '!docs/**' + - '!*.md' pull_request: - paths-ignore: - - 'specs/**' - - '*.md' + paths: + - '**' + - '!.github/**' + - '.github/workflows/ci.yml' + - '!specs/**' + - '!docs/**' + - '!*.md' run-name: ${{ github.event_name == 'pull_request' && 'Files PR Validation' || 'Files CI Validation' }} From c3f58cf0386fbf420da8f3506fe887b4dbda81d4 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 12 Dec 2023 05:03:47 +0000 Subject: [PATCH 6/8] Delete production and update deployment --- .github/workflows/deployment.yml | 36 ++++--- .github/workflows/production.yml | 137 -------------------------- builds/azure-pipelines-release.yml | 150 ----------------------------- scripts/Configure-AppxManifest.ps1 | 29 +++--- 4 files changed, 36 insertions(+), 316 deletions(-) delete mode 100644 .github/workflows/production.yml diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 22a7637608bf..5efa86b877a9 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -8,7 +8,7 @@ name: Files Deployment on: - workflow_call: + workflow_dispatch: inputs: branch: description: 'Select a branch' @@ -18,7 +18,6 @@ on: options: - Preview - Stable - workflow_dispatch: env: SOLUTION_NAME: 'Files.sln' @@ -32,6 +31,7 @@ env: ARTIFACTS_STAGING_DIR: ${{ github.workspace }}\artifacts APPX_PACKAGE_DIR: ${{ github.workspace }}\artifacts\AppxPackages PACKAGE_DEPLOYMENT_BRANCH: 'Preview' # NOTE: This is just placeholder + PACKAGE_DEPLOYMENT_BRANCH_LOWERCASE: 'preview' # NOTE: This is just placeholder run-name: Files Deployment @@ -45,13 +45,10 @@ jobs: steps: - name: Checkout the repository uses: actions/checkout@v3 - - name: Setup MSBuild uses: microsoft/setup-msbuild@v1 - - name: Setup NuGet uses: NuGet/setup-nuget@v1.1.1 - - name: Setup .NET 7 uses: actions/setup-dotnet@v3 with: @@ -60,12 +57,18 @@ jobs: - name: Set the correct value to PACKAGE_DEPLOYMENT_BRANCH shel: pwsh run: | - if [[ "$WORKFLOW_EVENT_NAME" == "workflow_call" ]]; then - echo "$REQUESTED_BRANCH_NAME" >> $PACKAGE_DEPLOYMENT_BRANCH ` - echo "$REQUESTED_BRANCH_NAME" >> $CONFIGURATION + if [[ "$WORKFLOW_EVENT_NAME" == "workflow_call" ]]; then \ + echo "${BRANCH_NAME_REQUESTED_BY_CALL}" >> ${PACKAGE_DEPLOYMENT_BRANCH} \ + echo "${BRANCH_NAME_REQUESTED_BY_CALL,,}" >>${PACKAGE_DEPLOYMENT_BRANCH_LOWERCASE} \ + echo "${BRANCH_NAME_REQUESTED_BY_CALL}" >> ${CONFIGURATION} \ + if [[ "$WORKFLOW_EVENT_NAME" == "workflow_dispatch" ]]; then \ + echo "${BRANCH_NAME_REQUESTED_BY_DISPATCH}" >> ${PACKAGE_DEPLOYMENT_BRANCH} \ + echo "${BRANCH_NAME_REQUESTED_BY_DISPATCH,,}" >>${PACKAGE_DEPLOYMENT_BRANCH_LOWERCASE} + echo "${BRANCH_NAME_REQUESTED_BY_DISPATCH}" >> ${CONFIGURATION} \ env: WORKFLOW_EVENT_NAME: ${{ github.event_name }} - REQUESTED_BRANCH_NAME: ${{ workflow_call.inputs.branch }} + BRANCH_NAME_REQUESTED_BY_CALL: ${{ workflow_call.inputs.branch }} + BRANCH_NAME_REQUESTED_BY_DISPATCH: ${{ workflow_dispatch.inputs.branch }} - name: Configure the package manifest & logo sets shell: pwsh @@ -132,11 +135,7 @@ jobs: -p:AppxBundle=Always ` -p:UapAppxPackageBuildMode=Sideload ` -p:GenerateAppInstallerFile=True ` - -p:AppInstallerUri=https://cdn.files.community/files/$env:PACKAGE_DEPLOYMENT_BRANCH/ - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete + -p:AppInstallerUri=https://cdn.files.community/files/$env:PACKAGE_DEPLOYMENT_BRANCH_LOWERCASE/ - name: Sign files with Azure Code Signing uses: azure/azure-code-signing-action@v0.2.21 @@ -160,11 +159,16 @@ jobs: with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: Upload to the Azure Blob Storage + - name: Upload the package to the Azure Blob Storage uses: azure/powershell@v1 with: inlineScript: | - az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true + az storage blob upload-batch + --account-name "filescommunity" + --destination "files" + --destination-path "${{ env.PACKAGE_DEPLOYMENT_BRANCH_LOWERCASE }}" + --source ${{ env.APPX_PACKAGE_DIR }} + --overwrite true azPSVersion: "latest" - name: Logout from the Azure CLI diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml deleted file mode 100644 index a7b0e13c47f4..000000000000 --- a/.github/workflows/production.yml +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (c) 2023 Files Community -# Licensed under the MIT License. See the LICENSE. - -# Abstract: -# - This workflow is triggered manually when the maintainer wants publish -# a new submission to the Microsoft Store. -# - Before submitting to the MS Store, the workflow deploy the package to -# the Azure Blob Storage. - -name: Files Production - -on: - workflow_dispatch: - -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: ${{ workflow_dispatch.inputs.branch }} - PLATFORM: 'x64' - 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 - PACKAGE_DEPLOYMENT_BRANCH: 'Stable' - PACKAGE_SUBMISSION_BRANCH: 'Store' - -run-name: Files Production - -jobs: - # Deploy the package with Stable configured to the Azure Blob Storage - deploy: - runs-on: windows-latest - strategy: - fail-fast: false - - steps: - - name: Deploy to the Azure Blob Storage - uses: files-community/Files/.github/workflows/deployment.yml@main - with: - branch: ${{ env.PACKAGE_DEPLOYMENT_BRANCH }} - - # Submit the package with Store configured to the Microsoft Store - sumbit: - runs-on: windows-latest - environment: Deployments - strategy: - fail-fast: false - - steps: - - name: Checkout the repository - uses: actions/checkout@v3 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - - - name: Setup NuGet - uses: NuGet/setup-nuget@v1.1.1 - - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '7.0.x' - - - name: Configure the package manifest & logo sets - shell: pwsh - run: | - . './scripts/Configure-AppxManifest.ps1' ` - -Branch "$env:PACKAGE_SUBMISSION_BRANCH" ` - -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` - -Publisher "$env:PRODUCTION_PUBLISHER" ` - -WorkingDir "$env:WORKING_DIR" - env: - PRODUCTION_PUBLISHER: 'CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7' - - - name: Inject the Bing Maps API token - shell: pwsh - run: | - . './scripts/Replace-SpecialString.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "bingmapskey.secret" -New "$env:BING_MAPS_SECRET" - env: - BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} - - - name: Inject the AppCenter token - shell: pwsh - run: | - . './scripts/Replace-SpecialString.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "appcenter.secret" -New "$env:APP_CENTER_SECRET" - env: - APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} - - - name: Inject the GitHub OAuth client ID - run: | - . './scripts/Replace-SpecialString.ps1' ` - -WorkingDir "$env:WORKING_DIR" -Target "githubclientid.secret" -New "$env:GH_OAUTH_CLIENT_ID" - env: - GH_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.sln - 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=Sideload ` - -p:GenerateAppInstallerFile=True ` - -p:AppInstallerUri=https://cdn.files.community/files/preview/ - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete - -## Create, update and publish submission \ No newline at end of file diff --git a/builds/azure-pipelines-release.yml b/builds/azure-pipelines-release.yml index 5458bdaf807c..af08e4b10f0c 100644 --- a/builds/azure-pipelines-release.yml +++ b/builds/azure-pipelines-release.yml @@ -4,36 +4,6 @@ pr: none pool: vmImage: 'windows-latest' -parameters: - - name: releaseBranch - displayName: Release Branch - type: string - default: 'stable' - values: - - 'stable' - - 'preview' - - name: packageIdentityName - displayName: Package Identity Name - type: string - default: 'Files' - values: - - 'Files' - - 'FilesPreview' - - name: packageDisplayName - displayName: Package Display Name - type: string - default: 'Files' - values: - - 'Files' - - 'Files - Preview' - - name: iconVariant - displayName: Icon Variant - type: string - default: 'Release' - values: - - 'Release' - - 'Preview' - variables: - group: BuildPipelineVariables - name: solution @@ -48,126 +18,6 @@ variables: value: '$(build.artifactStagingDirectory)\AppxPackages\\' jobs: -### Stable release ### -- job: StableRelease - timeoutInMinutes: 120 - steps: - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: | - [xml]$xmlDoc = Get-Content '$(Build.SourcesDirectory)\src\Files.App (Package)\Package.appxmanifest' - $xmlDoc.Package.Identity.Name="${{parameters.packageIdentityName}}" - $xmlDoc.Package.Identity.Publisher="Files" - $xmlDoc.Package.Properties.DisplayName="${{parameters.packageDisplayName}}" - $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="${{parameters.packageDisplayName}}" - $xmlDoc.Save('$(Build.SourcesDirectory)\src\Files.App (Package)\Package.appxmanifest') - failOnStderr: true - - # This replaces references to the dev icon with the stable icon variant - - task: PowerShell@2 - displayName: 'Use Correct Logo' - inputs: - targetType: 'inline' - script: | - gci $(Build.SourcesDirectory)\src -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process { - (Get-Content $_ -Raw | ForEach -Process {$_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\${{parameters.iconVariant}}"}) | Set-Content $_ -NoNewline - } - failOnStderr: true - - - task: DownloadSecureFile@1 - name: mapsDevKey - displayName: 'Download Bing Maps Dev Key' - inputs: - secureFile: 'BingMapsKey.txt' - -# Adds the Bing maps token to the project - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Agent.TempDirectory)' - Contents: '$(mapsDevKey.secureFilePath)' - TargetFolder: '$(Build.SourcesDirectory)\src\Files.App\Resources' - overWrite: true - -# Injects the AppCenter token to the project - - task: PowerShell@2 - displayName: 'Inject AppCenter token' - inputs: - targetType: 'inline' - script: | - gci $(Build.SourcesDirectory)\src -Include *.cs -recurse | ForEach -Process { - (Get-Content $_ -Raw | ForEach -Process {$_ -replace "appcenter.secret", "$(appcenter.secret)"}) | Set-Content $_ -NoNewline - } - failOnStderr: true - -# Injects the GitHub token to the project - - task: PowerShell@2 - displayName: 'Inject AppCenter token' - inputs: - targetType: 'inline' - script: | - gci $(Build.SourcesDirectory)\src -Include *.cs -recurse | ForEach -Process { - (Get-Content $_ -Raw | ForEach -Process {$_ -replace "githubclientid.secret", "$(githubclientid.secret)"}) | Set-Content $_ -NoNewline - } - failOnStderr: true - - - task: UseDotNet@2 - inputs: - packageType: sdk - version: 7.0.x - includePreviewVersions: true - - - task: CmdLine@2 - inputs: - script: | - for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt - - - task: MSBuild@1 - inputs: - platform: 'x64' - solution: '$(solution)' - configuration: '$(stableBuildConfiguration)' - msbuildArguments: '/t:restore /p:Configuration="$(stableBuildConfiguration)";Platform="$(buildPlatform)";PublishReadyToRun=true' - maximumCpuCount: true - - - task: DownloadSecureFile@1 - name: caCertificate - displayName: 'Download CA certificate' - inputs: - secureFile: '$(signingCert.secureFilePath)' - - - task: MSBuild@1 - inputs: - solution: '**/*.wapproj' - platform: 'x64' - configuration: '$(stableBuildConfiguration)' - msbuildArguments: '/t:build;_GenerateAppxPackage /p:AppxLogTelemetryFromSideloadingScript=False /p:GenerateAppInstallerFile=True /p:AppInstallerUri=https://cdn.files.community/files/${{parameters.releaseBranch}}/ /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxPackageSigningEnabled=true /p:PackageCertificateKeyFile="$(caCertificate.secureFilePath)" /p:PackageCertificatePassword="$(signingCert.password)" /p:PackageCertificateThumbprint=""' - maximumCpuCount: true - - - task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(system.defaultworkingdirectory)' - Contents: '**\bin\$(stableBuildConfiguration)\**' - TargetFolder: '$(build.artifactstagingdirectory)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: Sideload' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' - ArtifactName: 'Sideload' - publishLocation: 'Container' - - - task: AzureFileCopy@4 - inputs: - SourcePath: '$(build.artifactstagingdirectory)\AppxPackages\*' - azureSubscription: 'azureconnection' - Destination: 'AzureBlob' - storage: 'filescommunity' - ContainerName: 'files' - BlobPrefix: '${{parameters.releaseBranch}}' - -### Store release ### - job: StoreRelease timeoutInMinutes: 120 diff --git a/scripts/Configure-AppxManifest.ps1 b/scripts/Configure-AppxManifest.ps1 index 47ac0181c203..a61b6341bf73 100644 --- a/scripts/Configure-AppxManifest.ps1 +++ b/scripts/Configure-AppxManifest.ps1 @@ -4,7 +4,7 @@ param( [string]$Branch = "", [string]$PackageProjectDir = "" - [string]$Publisher = "Files" + [string]$Publisher = "" [string]$WorkingDir = "" ) @@ -13,30 +13,33 @@ $xmlDoc.Package.Identity.Publisher="$Publisher" if ($Branch -eq "Preview") { + # Set identities $xmlDoc.Package.Identity.Name="FilesPreview" $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") { + # Set identities $xmlDoc.Package.Identity.Name="Files" $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") { + # Set identities $xmlDoc.Package.Identity.Name="49306atecsolution.FilesUWP" $xmlDoc.Package.Properties.DisplayName="Files" $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files" @@ -48,10 +51,10 @@ 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 } } From eaaff7b0a78d4f3477134609921526841c0524c5 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 12 Dec 2023 05:06:12 +0000 Subject: [PATCH 7/8] Update --- scripts/Replace-SpecialString.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Replace-SpecialString.ps1 b/scripts/Replace-SpecialString.ps1 index 6a4670fded5e..cbc9ab9a21df 100644 --- a/scripts/Replace-SpecialString.ps1 +++ b/scripts/Replace-SpecialString.ps1 @@ -7,8 +7,8 @@ param( [string]$New = "" ) -Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process ` +Get-ChildItem "$WorkingDir\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process { ` - (Get-Content $_ -Raw | ForEach -Process { $_ -replace "$Target", "$New" }) | ` - Set-Content $_ -NoNewline ` + (Get-Content $_ -Raw | ForEach -Process { $_ -replace "$Target", "$New" }) | + Set-Content $_ -NoNewline } From adde9dadc63dd1bdbd39ebc5e694cacb80bf6f93 Mon Sep 17 00:00:00 2001 From: 0x5bfa <62196528+0x5bfa@users.noreply.github.com> Date: Fri, 22 Dec 2023 09:23:28 +0900 Subject: [PATCH 8/8] Update deployment.yml --- .github/workflows/deployment.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 5efa86b877a9..3aa24c248a8b 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -12,8 +12,7 @@ on: inputs: branch: description: 'Select a branch' - required: false - default: 'Preview' + required: true type: choice options: - Preview