Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5bfa committed Dec 11, 2023
1 parent 75f8b89 commit 64a6e14
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 82 deletions.
48 changes: 18 additions & 30 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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 `
Expand All @@ -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 }}

Expand All @@ -118,16 +108,18 @@ 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 `
-t:Restore `
-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" `
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
73 changes: 21 additions & 52 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}

Expand All @@ -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 `
Expand All @@ -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" `
Expand All @@ -128,41 +134,4 @@ jobs:
shell: bash
run: find $ARTIFACTS_STAGING_DIR -empty -delete

- name: Sign files with Azure Code 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://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

0 comments on commit 64a6e14

Please sign in to comment.