| 1 | trigger: |
| 2 | branches: |
| 3 | include: |
| 4 | - master |
| 5 | paths: |
| 6 | include: |
| 7 | - 'localization/strings/en-US/Resources.resw' |
| 8 | - 'intune/en-US/WSL.adml' |
| 9 | |
| 10 | # Schedule nightly build |
| 11 | # Cron syntax: "mm HH DD MM DW" = minutes, hours, days, months, day of week (UTC time) |
| 12 | schedules: |
| 13 | # "0 8" = 8AM UTC = 12AM PST |
| 14 | - cron: "0 8 * * *" |
| 15 | displayName: Nightly Touchdown Build Schedule |
| 16 | branches: |
| 17 | include: |
| 18 | - "master" |
| 19 | always: true |
| 20 | |
| 21 | # Build.SourceBranchName is only the leaf segment of the ref (e.g. |
| 22 | # 'loc-pipeline-debug' for refs/heads/user/benhill/loc-pipeline-debug), which |
| 23 | # fails GitHub's pulls API with a 422 'base invalid' when the branch name |
| 24 | # contains slashes. Strip 'refs/heads/' from the full ref instead so the PR |
| 25 | # targets the actual branch the pipeline ran against. |
| 26 | variables: |
| 27 | targetBranch: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ] |
| 28 | |
| 29 | pool: |
| 30 | vmImage: 'windows-latest' |
| 31 | |
| 32 | steps: |
| 33 | - checkout : self |
| 34 | persistCredentials: true |
| 35 | |
| 36 | - task: TouchdownBuildTask@5 |
| 37 | displayName: Touchdown Build Localization |
| 38 | inputs: |
| 39 | environment: 'PRODEXT' |
| 40 | teamId: '38646' |
| 41 | serviceTreeId: 'd8846bef-e9b5-4542-bcfc-98ebabac8a7b' |
| 42 | authType: 'FederatedIdentity' |
| 43 | FederatedIdentityServiceConnection: 'Azure-Connection' |
| 44 | isPreview: false |
| 45 | resourceFilePath: | |
| 46 | localization\strings\en-US\Resources.resw;O:localization\strings\ |
| 47 | storebroker\PDPs\en-us\PDP.xml;O:storebroker\PDPs\ |
| 48 | intune\en-US\WSL.adml;O:intune\ |
| 49 | localizationTarget: true |
| 50 | pseudoSetting: 'Excluded' |
| 51 | cultureMappingType: 'None' |
| 52 | |
| 53 | - task: PipAuthenticate@1 |
| 54 | condition: and(succeeded(), in(variables['Build.Reason'], 'Schedule', 'Manual')) |
| 55 | inputs: |
| 56 | artifactFeeds: 'wsl' |
| 57 | |
| 58 | - task: AzureKeyVault@2 |
| 59 | displayName: Fetch GitHub PR token from Key Vault |
| 60 | condition: and(succeeded(), in(variables['Build.Reason'], 'Schedule', 'Manual')) |
| 61 | inputs: |
| 62 | azureSubscription: 'Azure-Connection' |
| 63 | KeyVaultName: 'wsl-ci-key-vault' |
| 64 | SecretsFilter: 'GithubPRToken' |
| 65 | |
| 66 | - powershell: | |
| 67 | pip install --user -r tools/devops/requirements.txt |
| 68 | python tools/devops/create-change.py . "$env:token" "WSL localization" "Localization change from build: $env:buildId" "user/localization/$env:buildId" "$env:targetBranch" |
| 69 | |
| 70 | displayName: Create pull request |
| 71 | condition: and(succeeded(), in(variables['Build.Reason'], 'Schedule', 'Manual')) |
| 72 | env: |
| 73 | token: $(GithubPRToken) |
| 74 | buildId: $(Build.BuildId) |
| 75 | targetBranch: $(targetBranch) |