Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub: Added CD workflow to publish to Store #496

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/cd-store.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright (c) 2024 0x5BFA
# Licensed under the MIT License. See the LICENSE.

name: FluentHub CD (Store)

on:
workflow_dispatch:

run-name: 'FluentHub CD (Store)'

jobs:

build:

if: github.repository_owner == '0x5bfa'

runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [Store]
platform: [x64]
env:
APPX_BUNDLE_PLATFORMS: 'x64|arm64'
CONFIGURATION: '${{ matrix.configuration }}'
ARCHITECTURE: '${{ matrix.platform }}'
WORKING_DIR: '${{ github.workspace }}' # Default: 'D:\a\FluentHub\FluentHub'
SOLUTION_PATH: '${{ github.workspace }}\FluentHub.sln'
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\FluentHub.Package'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\FluentHub.Package\FluentHub.Package.wapproj'
APP_CREDENTIALS_PATH: '${{ github.workspace }}\src\FluentHub.App\AppCredentials.config'
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@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Save base64 credentials into a file
shell: pwsh
run: |
$bytes = [Convert]::FromBase64String($env:GH_CREDENTIALS_SECRET)
[IO.File]::WriteAllBytes($env:APP_CREDENTIALS_PATH, $bytes)
env:
GH_CREDENTIALS_SECRET: '${{ secrets.GH_CREDENTIALS_JSON_BASE64 }}'

- name: Restore NuGet
shell: pwsh
run: 'nuget restore $env:SOLUTION_PATH'

- name: Restore FluentHub
shell: pwsh
run: |
msbuild $env:SOLUTION_PATH `
-t:Restore `
-p:Platform=$env:ARCHITECTURE `
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true

- name: Build & package FluentHub
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=StoreUpload

- name: Upload the packages to the Artifacts
uses: actions/upload-artifact@v4
with:
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.ARCHITECTURE }})'
path: ${{ env.ARTIFACTS_STAGING_DIR }}
26 changes: 12 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ on:
run-name: ${{ github.event_name == 'pull_request' && 'FluentHub PR Validation' || 'FluentHub CI Validation' }}

env:
WORKING_DIR: '${{ github.workspace }}' # Default: 'D:\a\FluentHub\FluentHub'
SOLUTION_PATH: '${{ github.workspace }}\FluentHub.sln'
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\FluentHub.Package'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\FluentHub.Package\FluentHub.Package.wapproj'
AUTOMATED_TESTS_ARCHITECTURE: 'x64'
AUTOMATED_TESTS_CONFIGURATION: 'Release'
ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts'
APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages'
APP_CREDENTIALS_PATH: '${{ github.workspace }}\src\FluentHub.App\AppCredentials.config'
WORKING_DIR: '${{ github.workspace }}' # Default: 'D:\a\FluentHub\FluentHub'
SOLUTION_PATH: '${{ github.workspace }}\FluentHub.sln'
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\FluentHub.Package'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\FluentHub.Package\FluentHub.Package.wapproj'
APP_CREDENTIALS_PATH: '${{ github.workspace }}\src\FluentHub.App\AppCredentials.config'
ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts'
APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages'

jobs:

Expand Down Expand Up @@ -88,13 +86,13 @@ jobs:
steps:

- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
uses: NuGet/setup-nuget@v2
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

Expand Down Expand Up @@ -130,7 +128,7 @@ jobs:
-p:AppxBundle=Never

- name: Upload the packages to the Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.ARCHITECTURE }})'
path: ${{ env.ARTIFACTS_STAGING_DIR }}
Loading