Skip to content

Commit

Permalink
Work CI-CD
Browse files Browse the repository at this point in the history
- Brought update dependents PS1 script up to date.
- Remove unnecessary tasks from AZDO yaml.
- Fix GH token var.

***NO_CI***
  • Loading branch information
josesimoes committed Jun 2, 2023
1 parent c1fd20d commit 607000b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
15 changes: 2 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,29 +317,18 @@ jobs:
steps:
# need this here in order to persist GitHub credentials
- checkout: self
fetchDepth: 100
persistCredentials: true
fetchDepth: 1

- template: azure-pipelines-templates/install-nuget.yml@templates

- script: nbgv cloud -a -c
condition: succeeded()
displayName: Set build number

- task: InstallNanoMSBuildComponents@1
condition: succeeded()
displayName: Install nanoFramework MSBuild components
env:
GITHUB_TOKEN: $(GitHubToken)

# update dependencies
- task: PowerShell@2
displayName: Update dependent class libs
inputs:
targetType: filePath
filePath: azure-pipelines/update-dependencies.ps1
env:
MY_GITHUB_TOKEN: $(GitHubToken)
GH_TOKEN: $(GitHubToken)

##################################
# report build failure to Discord
Expand Down
8 changes: 5 additions & 3 deletions azure-pipelines/update-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$env:MY_GITHUB_TOKEN"))))"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$env:GH_TOKEN")))"

# init/reset these
$commitMessage = ""
$prTitle = ""
$newBranchName = "develop-nfbot/update-dependencies/" + [guid]::NewGuid().ToString()
$packageTargetVersion = $env:NBGV_NuGetPackageVersion
$packageTargetVersion = gh release view --json tagName --jq .tagName
$packageTargetVersion = $packageTargetVersion -replace "v"

# working directory is agent temp directory
Write-Debug "Changing working directory to $env:Agent_TempDirectory"
Expand All @@ -33,10 +33,12 @@ git checkout --quiet develop | Out-Null
"*****************************************************************************************************" | Write-Host
"Updating nanoFramework.Tools.MetadataProcessor.MsBuildTask.Net package in VS2019 & VS2022 solution..." | Write-Host

dotnet restore
dotnet remove VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
dotnet add VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
dotnet remove VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
dotnet add VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.Tools.MetadataProcessor.MsBuildTask
nuget restore -uselockfile

"Bumping nanoFramework.Tools.MetadataProcessor.MsBuildTask to $packageTargetVersion." | Write-Host -ForegroundColor Cyan

Expand Down

0 comments on commit 607000b

Please sign in to comment.