Skip to content

Commit d6878eb

Browse files
authored
Apply publish and release pipelines improvements (#15802)
1 parent 90aa5f0 commit d6878eb

39 files changed

Lines changed: 2915 additions & 615 deletions

.ado/jobs/desktop.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,9 @@ jobs:
341341

342342
- template: ../templates/stop-packagers.yml
343343

344-
- task: BinSkim@4
345-
displayName: Run Binskim Analysis
344+
- script: node .ado/scripts/build.js --binskim --platform ${{ matrix.BuildPlatform }} --configuration ${{ matrix.BuildConfiguration }} --target desktop
345+
displayName: Run BinSkim Analysis
346346
condition: eq('${{ matrix.BuildConfiguration }}', 'Release')
347-
inputs:
348-
InputType: 'Basic'
349-
Function: 'analyze'
350-
TargetPattern: 'guardianGlob'
351-
AnalyzeTargetGlob: '$(Build.SourcesDirectory)\vnext\target\${{ matrix.BuildPlatform }}\${{ matrix.BuildConfiguration }}\React.Windows.Desktop.DLL\react-native-win32.dll'
352-
AnalyzeVerbose: true
353-
toolVersion: 'Latest'
354-
continueOnError: true
355347

356348
- template: ../templates/publish-build-artifacts.yml
357349
parameters:

.ado/jobs/setup.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,26 @@ jobs:
3434

3535
- script: npx lage build --scope @rnw-scripts/beachball-config --no-deps
3636
displayName: Build @rnw-scripts/beachball-config
37-
37+
38+
- script: |
39+
echo "System.PullRequest.SourceBranch = $(System.PullRequest.SourceBranch)"
40+
echo "Build.SourceBranch = $(Build.SourceBranch)"
41+
echo "Build.SourceBranchName = $(Build.SourceBranchName)"
42+
displayName: Print branch variables
43+
3844
- pwsh: |
39-
npx beachball check --branch origin/$(BeachBallBranchName) --verbose 2>&1 | Tee-Object -Variable beachballOutput
45+
npx --yes beachball check --branch origin/$(BeachBallBranchName) --verbose 2>&1 | Tee-Object -Variable beachballOutput
4046
$beachballErrors = $beachballOutput | Where-Object { $_ -match "ERROR: *"}
4147
$beachballErrors | ForEach { Write-Host "##vso[task.logissue type=warning]POSSIBLE $_" }
4248
displayName: Warn for possible invalid change files
49+
condition: not(startsWith(variables['System.PullRequest.SourceBranch'], 'prepare-release/'))
4350
4451
- ${{ if endsWith(parameters.buildEnvironment, 'PullRequest') }}:
45-
- script: npx beachball check --branch origin/$(BeachBallBranchName) --verbose --changehint "##vso[task.logissue type=error]Run \"yarn change\" from root of repo to generate a change file."
52+
- script: npx --yes beachball check --branch origin/$(BeachBallBranchName) --verbose --changehint "##vso[task.logissue type=error]Run \"yarn change\" from root of repo to generate a change file."
4653
displayName: Check for change files
54+
condition: not(startsWith(variables['System.PullRequest.SourceBranch'], 'prepare-release/'))
4755

48-
- script: npx beachball bump --branch origin/$(BeachBallBranchName) --yes --verbose
56+
- script: npx --yes beachball bump --branch origin/$(BeachBallBranchName) --yes --verbose
4957
displayName: beachball bump
5058

5159
- template: ../templates/set-version-vars.yml

.ado/jobs/universal.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,9 @@
244244
${{ else }}:
245245
artifactName: ReactWindows.${{ matrix.BuildPlatform }}.${{ matrix.BuildConfiguration }}
246246

247-
- task: BinSkim@4
248-
displayName: Run Binskim Analysis
247+
- script: node .ado/scripts/build.js --binskim --platform ${{ matrix.BuildPlatform }} --configuration ${{ matrix.BuildConfiguration }} --target universal
248+
displayName: Run BinSkim Analysis
249249
condition: and(succeeded(), eq('${{ matrix.BuildConfiguration }}', 'Release'), ne('${{ matrix.BuildPlatform }}', 'ARM64'))
250-
inputs:
251-
InputType: 'Basic'
252-
Function: 'analyze'
253-
TargetPattern: 'guardianGlob'
254-
AnalyzeTargetGlob: '$(Build.SourcesDirectory)\vnext\target\${{ matrix.BuildPlatform }}\${{ matrix.BuildConfiguration }}\Microsoft.ReactNative\Microsoft.ReactNative.dll'
255-
AnalyzeVerbose: true
256-
toolVersion: 'LatestPreRelease'
257250

258251
- template: ../templates/discover-google-test-adapter.yml
259252

.ado/prepare-release-bot.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: $(Date:yyyyMMdd).$(Rev:r)
2+
3+
# Triggers are configured in the ADO pipeline UI:
4+
# - CI triggers on pushes to main and *-stable branches
5+
# - Scheduled triggers for daily runs
6+
# - Manual runs with optional branch override
7+
trigger: none
8+
pr: none
9+
10+
parameters:
11+
- name: targetBranch
12+
displayName: Target branch for version bump (use default to use pipeline source branch)
13+
type: string
14+
default: (source branch)
15+
values:
16+
- (source branch)
17+
- main
18+
- 0.82-stable
19+
- 0.81-stable
20+
- 0.80-stable
21+
- 0.74-stable
22+
23+
jobs:
24+
- job: PrepareRelease
25+
displayName: Prepare Release Bot
26+
pool:
27+
vmImage: windows-latest
28+
timeoutInMinutes: 30
29+
30+
steps:
31+
- checkout: self
32+
persistCredentials: true
33+
fetchDepth: 1
34+
fetchTags: false
35+
36+
- script: |
37+
git config user.name "React-Native-Windows Bot"
38+
git config user.email "53619745+rnbot@users.noreply.github.com"
39+
displayName: Configure Git Identity
40+
41+
# Extract OAuth token from persistCredentials for GitHub API access (gh CLI)
42+
- pwsh: |
43+
$headerLine = git config --get-regexp "http.*\.extraheader" 2>$null | Select-Object -First 1
44+
if (-not $headerLine) {
45+
Write-Host "##[error]No HTTP extraheader found. persistCredentials may not be working."
46+
exit 1
47+
}
48+
$encoded = ($headerLine.Split(' ')[-1]).Trim()
49+
$decoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded))
50+
$token = $decoded.Split(':')[-1]
51+
Write-Host "Extracted GitHub OAuth token (length=$($token.Length))"
52+
Write-Host "##vso[task.setvariable variable=GitHubOAuthToken;issecret=true]$token"
53+
displayName: Extract GitHub OAuth token
54+
55+
- task: NodeTool@0
56+
displayName: Set Node Version
57+
inputs:
58+
versionSpec: '24.x'
59+
60+
- script: if not exist %APPDATA%\npm (mkdir %APPDATA%\npm)
61+
displayName: Ensure npm directory for npx commands
62+
63+
- script: npx --yes midgard-yarn@1.23.34 --ignore-scripts --frozen-lockfile
64+
displayName: yarn install
65+
66+
- script: npx lage build --scope @rnw-scripts/prepare-release --scope @rnw-scripts/beachball-config
67+
displayName: Build prepare-release and dependencies
68+
69+
- ${{ if ne(parameters.targetBranch, '(source branch)') }}:
70+
- pwsh: Write-Host "##vso[task.setvariable variable=TargetBranch]${{ parameters.targetBranch }}"
71+
displayName: Set target branch from parameter
72+
- ${{ else }}:
73+
- pwsh: Write-Host "##vso[task.setvariable variable=TargetBranch]$(Build.SourceBranchName)"
74+
displayName: Set target branch from source
75+
76+
- script: npx prepare-release --branch $(TargetBranch) --no-color
77+
displayName: Prepare Release
78+
env:
79+
GH_TOKEN: $(GitHubOAuthToken)

0 commit comments

Comments
 (0)