From f608a537618e760823cbfaf832944fab7e0f1274 Mon Sep 17 00:00:00 2001 From: "Anatolii Bolshakov (Akvelon INC)" Date: Wed, 16 Jun 2021 20:15:42 +0300 Subject: [PATCH] Returned back missed files --- Localize/LocProject.json | 14 +++++ Localize/localize-pipeline.yml | 102 +++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 Localize/LocProject.json create mode 100644 Localize/localize-pipeline.yml diff --git a/Localize/LocProject.json b/Localize/LocProject.json new file mode 100644 index 0000000..1d0e7c8 --- /dev/null +++ b/Localize/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LocItems": [ + { + "Languages": "de-DE;es-ES;fr-FR;it-IT;ja-JP;ko-KR;ru-RU;zh-CN;zh-TW", + "SourceFile": "Strings\\resources.resjson\\en-US\\resources.resjson", + "CopyOption": "LangIDOnPath", + "OutputPath": "Strings\\resources.resjson" + } + ] + } + ] +} \ No newline at end of file diff --git a/Localize/localize-pipeline.yml b/Localize/localize-pipeline.yml new file mode 100644 index 0000000..0166286 --- /dev/null +++ b/Localize/localize-pipeline.yml @@ -0,0 +1,102 @@ +name: $(Date:MMddyy)$(Rev:.rrrr) + +trigger: none + +schedules: +- cron: 0 8 * * Mon # mm HH DD MM DW + displayName: Localization update + branches: + include: + - Localization + always: true + +stages: +- stage: __default + jobs: + - job: LocalizationUpdate + pool: + vmImage: windows-latest + steps: + + - checkout: self + persistCredentials: true + + - powershell: | + $sprintInfo = Invoke-WebRequest https://whatsprintis.it -Headers @{"Accept"= "application/json"} | ConvertFrom-Json + if (($env:PR_CREATION_ENABLED -eq 'True') -and (($sprintInfo.week -eq 3) -or ($env:BUILD_REASON -eq 'Manual'))) + { + Write-Host "shouldCreatePR was set to true" + Write-Host "##vso[task.setvariable variable=shouldCreatePR]$($true)" + } + else + { + Write-Host "shouldCreatePR was set to false" + Write-Host "##vso[task.setvariable variable=shouldCreatePR]$($false)" + } + displayName: "Determine the number of the week in the sprint and sprint number" + - powershell: | + git config --global user.email "$(github_email)" + git config --global user.name "$(username)" + git checkout -b Localization origin/Localization + git merge origin/master + git push origin Localization + displayName: "Sync with master branch" + condition: and(succeeded(), in(variables['build.reason'], 'Schedule', 'Manual')) + - task: OneLocBuild@2 + condition: and(succeeded(), in(variables['build.reason'], 'Schedule', 'Manual')) + inputs: + locProj: 'Localize/LocProject.json' + outDir: '$(Build.ArtifactStagingDirectory)' + packageSourceAuth: 'patAuth' + patVariable: '$(OneLocBuildPAT)' + isCreatePrSelected: $(shouldCreatePR) + repoType: 'gitHub' + prSourceBranchPrefix: 'Localize' + gitHubPatVariable: '$(GitHubPAT)' + isAutoCompletePrSelected: true + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + + - task: PublishBuildArtifacts@1 + condition: and(succeeded(), in(variables['build.reason'], 'Schedule', 'Manual')) + displayName: 'Publish an artifact' + + - powershell: | + $date= Get-Date -Format "MMddyyyy" + $updateBranch="Localization-update_$date" + echo "##vso[task.setvariable variable=updateBranch]$updateBranch" + git checkout -b $updateBranch + Remove-Item -Recurse -Force Localize + git add -A + git commit -m "Removing Localize folder" + git push origin $updateBranch + displayName: Create and push localization update branch + condition: and(succeeded(), or(and(eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule')), eq(variables['build.reason'], 'Manual'))) + + - task: PowerShell@2 + inputs: + filePath: 'open-pullrequest.ps1' + arguments: "-SourceBranch $(updateBranch)" + failOnStderr: true + env: + GH_TOKEN: '$(GitHubPAT)' + displayName: Open a PR + condition: and(succeeded(), or(and(eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule')), eq(variables['build.reason'], 'Manual'))) + + - powershell: | + $message="Created tool-lib localization update PR. Someone please approve/merge it. :please-puss-in-boots: $env:PR_LINK" + $body = [PSCustomObject]@{ + text = $message + } | ConvertTo-Json + Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json' + displayName: 'Send Slack notification about PR opened' + condition: and(succeeded(), eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule')) + - powershell: | + $buildUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)&_a=summary" + $message="Something went wrong while creating tool-lib localization update PR. Build: $buildUrl" + $body = [PSCustomObject]@{ + text = $message + } | ConvertTo-Json + Invoke-RestMethod -Uri $(slackUri) -Method Post -Body $body -ContentType 'application/json' + displayName: 'Send Slack notification about error' + condition: and(failed(), eq(variables['SHOULDCREATEPR'], 'True'), eq(variables['build.reason'], 'Schedule')) \ No newline at end of file