|
| 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