Skip to content

Commit ed766c7

Browse files
authored
ci: refactor Windows App SDK step (#2665)
1 parent 3f9d4ec commit ed766c7

3 files changed

Lines changed: 29 additions & 11 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Install Windows App SDK
2+
description: Installs the Windows App SDK and restores NuGet packages for the Windows app
3+
inputs:
4+
solution:
5+
description: Path to the solution file for the Windows app
6+
working-directory:
7+
description: Path to the working directory for this action
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Install Windows App SDK
12+
run: |
13+
$script = node --print "require.resolve('react-native-windows/Scripts/rnw-dependencies.ps1')"
14+
& $script -Install -NoPrompt -Enterprise
15+
nuget restore ${{ inputs.solution }}
16+
shell: powershell
17+
working-directory: ${{ inputs.working-directory }}

.github/workflows/build.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
HOMEBREW_NO_INSTALL_CLEANUP: 1
1313
NODE_OPTIONS: "--disable-proto=delete"
1414
VisualStudioVersion: "17.0"
15+
WindowsTargetPlatformVersion: "10.0.26100.0"
1516
concurrency:
1617
# Ensure single build of a pull request. `trunk` should not be affected.
1718
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }}
@@ -574,7 +575,7 @@ jobs:
574575
yarn build:windows
575576
- name: Generate Visual Studio solution
576577
run: |
577-
node ../windows/app.mjs --msbuildprops WindowsTargetPlatformVersion=10.0.26100.0
578+
node ../windows/app.mjs --msbuildprops WindowsTargetPlatformVersion=$env:WindowsTargetPlatformVersion
578579
working-directory: packages/app/example
579580
- name: Test `react-native config`
580581
run: |
@@ -585,10 +586,10 @@ jobs:
585586
uses: ./.github/actions/affected
586587
- name: Install Windows App SDK
587588
if: ${{ steps.affected.outputs.windows != '' }}
588-
run: |
589-
../node_modules/react-native-windows/Scripts/rnw-dependencies.ps1 -Install -NoPrompt -Enterprise
590-
nuget restore Example.sln
591-
working-directory: packages/app/example/windows
589+
uses: ./.github/actions/setup-windows-app-sdk
590+
with:
591+
solution: Example.sln
592+
working-directory: packages/app/example/windows
592593
- name: Build
593594
id: build
594595
if: ${{ steps.affected.outputs.windows != '' }}
@@ -653,17 +654,17 @@ jobs:
653654
working-directory: template-example
654655
- name: Generate Visual Studio solution
655656
run: |
656-
yarn install-windows-test-app --msbuildprops WindowsTargetPlatformVersion=10.0.26100.0
657+
yarn install-windows-test-app --msbuildprops WindowsTargetPlatformVersion=$env:WindowsTargetPlatformVersion
657658
working-directory: template-example
658659
- name: Determine whether the Windows app needs to be built
659660
id: affected
660661
uses: ./.github/actions/affected
661662
- name: Install Windows App SDK
662663
if: ${{ steps.affected.outputs.windows != '' }}
663-
run: |
664-
../node_modules/react-native-windows/Scripts/rnw-dependencies.ps1 -Install -NoPrompt -Enterprise
665-
nuget restore TemplateExample.sln
666-
working-directory: template-example/windows
664+
uses: ./.github/actions/setup-windows-app-sdk
665+
with:
666+
solution: TemplateExample.sln
667+
working-directory: template-example/windows
667668
- name: Build
668669
id: build
669670
if: ${{ steps.affected.outputs.windows != '' }}

packages/app/scripts/testing/test-e2e.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function $(command: string, ...args: string[]) {
2222
}
2323

2424
/**
25-
* Invokes a shell command with optional arguments. Similar {@link $}, but
25+
* Invokes a shell command with optional arguments. Similar to {@link $}, but
2626
* captures and returns stdout/stderr.
2727
*/
2828
export function $$(command: string, ...args: string[]): string {

0 commit comments

Comments
 (0)