|
1 | | -name: Deploy Preview Pipeline |
| 1 | +# Copyright (c) 2024 Files Community |
| 2 | +# Licensed under the MIT License. See the LICENSE. |
| 3 | + |
| 4 | +name: Files CD (Preview) |
2 | 5 |
|
3 | 6 | on: |
4 | 7 | workflow_dispatch: |
@@ -27,72 +30,31 @@ jobs: |
27 | 30 | steps: |
28 | 31 | - name: Checkout the repository |
29 | 32 | uses: actions/checkout@v4 |
30 | | - |
31 | 33 | - name: Setup MSBuild |
32 | 34 | uses: microsoft/setup-msbuild@v1 |
33 | | - |
34 | 35 | - name: Setup NuGet |
35 | 36 | uses: NuGet/setup-nuget@v1.1.1 |
36 | | - |
37 | 37 | - name: Setup .NET 8 |
38 | 38 | uses: actions/setup-dotnet@v3 |
39 | 39 | with: |
40 | 40 | dotnet-version: '8.0.x' |
41 | 41 |
|
42 | | - # TODO: Move the command to PowerShell script instead |
43 | | - - name: Update Package.appxmanifest |
| 42 | + - name: Configure the package manifest, logo sets, and secrets |
44 | 43 | shell: pwsh |
45 | 44 | run: | |
46 | | - [xml]$xmlDoc = Get-Content "$env:PACKAGE_PROJECT_DIR\Package.appxmanifest" |
47 | | - $xmlDoc.Package.Identity.Name="FilesPreview" |
48 | | - $xmlDoc.Package.Identity.Publisher="$env:SIDELOAD_PUBLISHER_SECRET" |
49 | | - $xmlDoc.Package.Properties.DisplayName="Files - Preview" |
50 | | - $xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview" |
51 | | - $xmlDoc.Save("$env:PACKAGE_PROJECT_DIR\Package.appxmanifest") |
| 45 | + . './scripts/Configure-AppxManifest.ps1' ` |
| 46 | + -Branch "$env:CONFIGURATION" ` |
| 47 | + -PackageProjectDir "$env:PACKAGE_PROJECT_DIR" ` |
| 48 | + -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` |
| 49 | + -WorkingDir "$env:WORKING_DIR" ` |
| 50 | + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` |
| 51 | + -SecretAppCenter "$env:SECRET_APPCENTER" ` |
| 52 | + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" |
52 | 53 | env: |
53 | 54 | SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} |
54 | | - |
55 | | - # TODO: Move the command to PowerShell script instead |
56 | | - - name: Use the ${{ env.CONFIGURATION }} logo sets |
57 | | - shell: pwsh |
58 | | - run: | |
59 | | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.csproj, *.appxmanifest, *.wapproj, *.xaml -recurse | ForEach -Process ` |
60 | | - { ` |
61 | | - (Get-Content $_ -Raw | ForEach -Process { $_ -replace "Assets\\AppTiles\\Dev", "Assets\AppTiles\Preview" }) | ` |
62 | | - Set-Content $_ -NoNewline ` |
63 | | - } |
64 | | -
|
65 | | - - name: Inject the Bing Maps API token |
66 | | - shell: pwsh |
67 | | - run: | |
68 | | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` |
69 | | - { ` |
70 | | - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "bingmapskey.secret", "$env:BING_MAPS_SECRET" }) | ` |
71 | | - Set-Content $_ -NoNewline ` |
72 | | - } |
73 | | - env: |
74 | | - BING_MAPS_SECRET: ${{ secrets.BING_MAPS_SECRET }} |
75 | | - |
76 | | - - name: Inject the AppCenter token |
77 | | - shell: pwsh |
78 | | - run: | |
79 | | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` |
80 | | - { ` |
81 | | - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "appcenter.secret", "$env:APP_CENTER_SECRET" }) | ` |
82 | | - Set-Content $_ -NoNewline ` |
83 | | - } |
84 | | - env: |
85 | | - APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }} |
86 | | - |
87 | | - - name: Inject the GitHub OAuth client ID |
88 | | - run: | |
89 | | - Get-ChildItem "$env:WORKING_DIR\src" -Include *.cs -recurse | ForEach-Object -Process ` |
90 | | - { ` |
91 | | - (Get-Content $_ -Raw | ForEach-Object -Process { $_ -replace "githubclientid.secret", "$env:GH_OAUTH_CLIENT_ID" }) | ` |
92 | | - Set-Content $_ -NoNewline ` |
93 | | - } |
94 | | - env: |
95 | | - GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} |
| 55 | + SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} |
| 56 | + SECRET_APPCENTER: ${{ secrets.APP_CENTER_SECRET }} |
| 57 | + SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} |
96 | 58 |
|
97 | 59 | - name: Use Windows SDK Preview |
98 | 60 | shell: cmd |
@@ -156,21 +118,20 @@ jobs: |
156 | 118 | timestamp-rfc3161: http://timestamp.acs.microsoft.com |
157 | 119 | timestamp-digest: SHA256 |
158 | 120 |
|
159 | | - - uses: azure/login@v1 |
| 121 | + - name: Login to Azure |
| 122 | + uses: azure/login@v1 |
160 | 123 | with: |
161 | | - creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 124 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
162 | 125 |
|
163 | | - - name: Upload to blob storage |
| 126 | + - name: Upload to Azure blob storage |
164 | 127 | uses: azure/powershell@v1 |
165 | 128 | with: |
166 | 129 | inlineScript: | |
167 | | - az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true |
| 130 | + az storage blob upload-batch --account-name "filescommunity" --destination "files" --destination-path "preview" --source ${{ env.APPX_PACKAGE_DIR }} --overwrite true |
168 | 131 | azPSVersion: "latest" |
169 | 132 |
|
170 | | - # Azure logout |
171 | | - - name: logout |
172 | | - run: | |
173 | | - az logout |
| 133 | + - name: Logout from Azure |
| 134 | + run: 'az logout' |
174 | 135 |
|
175 | 136 | - name: Upload the packages to GitHub Actions |
176 | 137 | uses: actions/upload-artifact@v3 |
|
0 commit comments