Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5bfa committed Apr 14, 2024
2 parents 9cc1798 + a05a5e5 commit 6b32cd8
Show file tree
Hide file tree
Showing 446 changed files with 4,669 additions and 2,476 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Expand Up @@ -23,7 +23,7 @@ Files also offers advanced features such as file tagging for easy organization,
- MSVC v143 - VS 2022 C++ x64/x86 or ARM64 build tools (latest)
- C++ ATL for latest v143 build tools (x86 & x64 or ARM64)
- Git for Windows
- [Windows App SDK 1.4](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads#current-releases)
- [Windows App SDK 1.5](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads#current-releases)

### 2. Clone the repository

Expand Down
140 changes: 140 additions & 0 deletions .github/workflows/cd-preview.yml
@@ -0,0 +1,140 @@
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.

name: Files CD (Preview)

on:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
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
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Configure the package manifest, logo sets, and secrets
shell: pwsh
run: |
. './scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-PackageProjectDir "$env:PACKAGE_PROJECT_DIR" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
-SecretAppCenter "$env:SECRET_APPCENTER" `
-SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID"
env:
SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }}
SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }}
SECRET_APPCENTER: ${{ secrets.APP_CENTER_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 ${{ 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: Update appinstaller schema
run: |
$newSchema = "http://schemas.microsoft.com/appx/appinstaller/2018"
$localFilePath = "${{ env.APPX_PACKAGE_DIR }}/Files.Package.appinstaller"
$fileContent = Get-Content $localFilePath
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath
- name: Sign files with Azure Trusted Signing
uses: azure/[email protected]
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://eus.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 Azure
uses: azure/login@v1
with:
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 "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true
azPSVersion: "latest"

- name: Logout from Azure
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 }}
140 changes: 140 additions & 0 deletions .github/workflows/cd-stable.yml
@@ -0,0 +1,140 @@
# Copyright (c) 2024 Files Community
# Licensed under the MIT License. See the LICENSE.

name: Files CD (Stable)

on:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
environment: Deployments
strategy:
fail-fast: false
matrix:
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

steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Configure the package manifest, logo sets, and secrets
shell: pwsh
run: |
. './scripts/Configure-AppxManifest.ps1' `
-Branch "$env:CONFIGURATION" `
-PackageProjectDir "$env:PACKAGE_PROJECT_DIR" `
-Publisher "$env:SIDELOAD_PUBLISHER_SECRET" `
-WorkingDir "$env:WORKING_DIR" `
-SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" `
-SecretAppCenter "$env:SECRET_APPCENTER" `
-SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID"
env:
SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }}
SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }}
SECRET_APPCENTER: ${{ secrets.APP_CENTER_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 ${{ 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/stable/
- name: Remove empty files from the packages
shell: bash
run: find $ARTIFACTS_STAGING_DIR -empty -delete

- name: Update appinstaller schema
run: |
$newSchema = "http://schemas.microsoft.com/appx/appinstaller/2018"
$localFilePath = "${{ env.APPX_PACKAGE_DIR }}/Files.Package.appinstaller"
$fileContent = Get-Content $localFilePath
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath
- name: Sign files with Azure Trusted Signing
uses: azure/[email protected]
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://eus.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 Azure
uses: azure/login@v1
with:
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
azPSVersion: "latest"

- name: Logout from Azure
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 }}
Expand Up @@ -139,13 +139,13 @@ jobs:
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath
- name: Sign files with Azure Code Signing
uses: azure/azure-code-signing-action@v0.2.21
- name: Sign files with Azure Trusted Signing
uses: azure/trusted-signing-action@v0.3.16
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/
endpoint: https://eus.codesigning.azure.net/
code-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }}
certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }}
files-folder: ${{ env.APPX_PACKAGE_DIR }}
Expand Down
Expand Up @@ -139,13 +139,13 @@ jobs:
$fileContent = $fileContent.Replace("http://schemas.microsoft.com/appx/appinstaller/2017/2", $newSchema)
$fileContent | Set-Content $localFilePath
- name: Sign files with Azure Code Signing
uses: azure/azure-code-signing-action@v0.2.21
- name: Sign files with Azure Trusted Signing
uses: azure/trusted-signing-action@v0.3.16
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/
endpoint: https://eus.codesigning.azure.net/
code-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }}
certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }}
files-folder: ${{ env.APPX_PACKAGE_DIR }}
Expand Down

0 comments on commit 6b32cd8

Please sign in to comment.