|
| 1 | +# Copyright (c) Files Community |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +name: Files CD |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + build-branch: |
| 10 | + type: choice |
| 11 | + description: Build branch |
| 12 | + options: |
| 13 | + - 'Preview' |
| 14 | + - 'Stable' |
| 15 | + default: 'Preview' |
| 16 | + publish-to-store: |
| 17 | + type: boolean |
| 18 | + description: Publish to Store as well |
| 19 | + default: 'true' |
| 20 | + |
| 21 | +env: |
| 22 | + CONFIGURATION: 'Release' |
| 23 | + PLATFORM: 'x64' |
| 24 | + APPX_BUNDLE_PLATFORMS: 'x64|arm64' |
| 25 | + WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\ |
| 26 | + SOLUTION_PATH: '${{ github.workspace }}\Files.sln' |
| 27 | + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' |
| 28 | + APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages' |
| 29 | + PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\Files.App (Package)' |
| 30 | + PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App (Package)\Files.Package.wapproj' |
| 31 | + PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App (Package)\Package.appxmanifest' |
| 32 | + APP_INSTALLER_SIDELOAD_URL: 'https://cdn.files.community/files/${{ github.event.inputs.build-branch }}/' |
| 33 | + |
| 34 | +jobs: |
| 35 | + sideload: |
| 36 | + runs-on: windows-latest |
| 37 | + environment: Deployments |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + env: |
| 41 | + BRANCH: 'Sideload${{ github.event.inputs.build-branch }}' # This is either SideloadPreview or SideloadStable |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout the repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + - name: Setup MSBuild |
| 47 | + uses: microsoft/setup-msbuild@v2 |
| 48 | + - name: Setup NuGet |
| 49 | + uses: NuGet/setup-nuget@v2 |
| 50 | + - name: Setup .NET 8 |
| 51 | + uses: actions/setup-dotnet@v4 |
| 52 | + with: |
| 53 | + global-json-file: global.json |
| 54 | + |
| 55 | + - name: Get sideload appinstaller URL |
| 56 | + id: tolowercase |
| 57 | + uses: ASzc/change-string-case-action@v6 |
| 58 | + with: |
| 59 | + string: ${{ github.event.inputs.build-branch }} |
| 60 | + |
| 61 | + - name: Build Files |
| 62 | + run: | |
| 63 | + . './.github/scripts/Configure-AppxManifest.ps1' ` |
| 64 | + -Branch "$env:BRANCH" ` |
| 65 | + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` |
| 66 | + -WorkingDir "$env:WORKING_DIR" ` |
| 67 | + -Publisher "$env:SECRET_PUBLISHER_NAME" ` |
| 68 | + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` |
| 69 | + -SecretSentry "$env:SECRET_SENTRY" ` |
| 70 | + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" |
| 71 | + . './.github/scripts/Build-AppSolution.ps1' ` |
| 72 | + -Branch "$env:BRANCH" ` |
| 73 | + -SolutionPath "$env:SOLUTION_PATH" ` |
| 74 | + -StartupProjectPath "$env:PACKAGE_PROJECT_PATH" ` |
| 75 | + -Configuration "$env:CONFIGURATION" ` |
| 76 | + -Platform "$env:PLATFORM" ` |
| 77 | + -AppxPackageDir "$env:APPX_PACKAGE_DIR" ` |
| 78 | + -AppInstallerUrl "$env:APP_INSTALLER_SIDELOAD_URL" |
| 79 | + env: |
| 80 | + SECRET_PUBLISHER_NAME: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} |
| 81 | + SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} |
| 82 | + SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} |
| 83 | + SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} |
| 84 | + APP_INSTALLER_SIDELOAD_URL: "https://cdn.files.community/files/${{ steps.tolowercase.outputs.lowercase }}/" |
| 85 | + |
| 86 | + - name: Sign Files with Azure Trusted Signing |
| 87 | + |
| 88 | + with: |
| 89 | + azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 90 | + azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 91 | + azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} |
| 92 | + endpoint: https://eus.codesigning.azure.net/ |
| 93 | + trusted-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }} |
| 94 | + certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }} |
| 95 | + files-folder: ${{ env.APPX_PACKAGE_DIR }} |
| 96 | + files-folder-filter: msixbundle |
| 97 | + files-folder-recurse: true |
| 98 | + files-folder-depth: 4 |
| 99 | + file-digest: SHA256 |
| 100 | + timestamp-rfc3161: http://timestamp.acs.microsoft.com |
| 101 | + timestamp-digest: SHA256 |
| 102 | + |
| 103 | + - name: Login to Azure |
| 104 | + uses: azure/login@v2 |
| 105 | + with: |
| 106 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 107 | + |
| 108 | + - name: Upload to Azure blob storage |
| 109 | + run: | |
| 110 | + az storage blob upload-batch ` |
| 111 | + --account-name "filescommunity" ` |
| 112 | + --destination "files" ` |
| 113 | + --destination-path "${{ github.event.inputs.build-branch }}" ` |
| 114 | + --source "${{ env.APPX_PACKAGE_DIR }}" ` |
| 115 | + --overwrite true |
| 116 | + az logout |
| 117 | +
|
| 118 | + - name: Upload the packages to GitHub Actions |
| 119 | + uses: actions/upload-artifact@v4 |
| 120 | + with: |
| 121 | + name: 'Appx Packages (${{ env.BRANCH }})' |
| 122 | + path: ${{ env.ARTIFACTS_STAGING_DIR }} |
| 123 | + |
| 124 | + store: |
| 125 | + runs-on: windows-latest |
| 126 | + environment: Deployments |
| 127 | + strategy: |
| 128 | + fail-fast: false |
| 129 | + env: |
| 130 | + BRANCH: 'Store${{ github.event.inputs.build-branch }}' # This is either StorePreview or StoreStable |
| 131 | + |
| 132 | + steps: |
| 133 | + - name: Checkout the repository |
| 134 | + uses: actions/checkout@v4 |
| 135 | + - name: Setup MSBuild |
| 136 | + uses: microsoft/setup-msbuild@v2 |
| 137 | + - name: Setup NuGet |
| 138 | + uses: NuGet/setup-nuget@v2 |
| 139 | + - name: Setup .NET 8 |
| 140 | + uses: actions/setup-dotnet@v4 |
| 141 | + with: |
| 142 | + global-json-file: global.json |
| 143 | + |
| 144 | + - name: Build Files |
| 145 | + run: | |
| 146 | + . './.github/scripts/Configure-AppxManifest.ps1' ` |
| 147 | + -Branch "$env:BRANCH" ` |
| 148 | + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` |
| 149 | + -WorkingDir "$env:WORKING_DIR" ` |
| 150 | + -Publisher "$env:SECRET_PUBLISHER_NAME" ` |
| 151 | + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` |
| 152 | + -SecretSentry "$env:SECRET_SENTRY" ` |
| 153 | + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" |
| 154 | + . './.github/scripts/Build-AppSolution.ps1' ` |
| 155 | + -Branch "$env:BRANCH" ` |
| 156 | + -SolutionPath "$env:SOLUTION_PATH" ` |
| 157 | + -StartupProjectPath "$env:PACKAGE_PROJECT_PATH" ` |
| 158 | + -Configuration "$env:CONFIGURATION" ` |
| 159 | + -Platform "$env:PLATFORM" ` |
| 160 | + -AppxPackageDir "$env:APPX_PACKAGE_DIR" |
| 161 | + env: |
| 162 | + SECRET_PUBLISHER_NAME: ${{ secrets.STORE_PUBLISHER_SECRET }} |
| 163 | + SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} |
| 164 | + SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} |
| 165 | + SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} |
| 166 | + |
| 167 | + - name: Publish the packages to Microsoft Store |
| 168 | + uses: isaacrlevin/windows-store-action@1 |
| 169 | + with: |
| 170 | + app-id: '9NGHP3DX8HDX' |
| 171 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 172 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 173 | + client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} |
| 174 | + package-path: '${{ env.ARTIFACTS_STAGING_DIR }}/**/*.msixupload' |
| 175 | + skip-polling: false |
| 176 | + packages-keep: 5 |
| 177 | + |
| 178 | + - name: Upload the packages to GitHub Actions |
| 179 | + uses: actions/upload-artifact@v4 |
| 180 | + with: |
| 181 | + name: 'Appx Packages (${{ env.BRANCH }})' |
| 182 | + path: ${{ env.ARTIFACTS_STAGING_DIR }} |
0 commit comments