Skip to content

Commit

Permalink
Work CD-CI
Browse files Browse the repository at this point in the history
- Improve PR check condition.
- Remove check for no ci tag in commit message (Azure now has that fixed).

***NO_CI***
  • Loading branch information
josesimoes committed Jun 12, 2020
1 parent ed504b5 commit b714673
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:
else
{
# get commit details, if this is a PR
if($env:Build_SourceBranch -like "refs/pull*")
if($env:Build_Reason -eq 'PullRequest')
{
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -ContentType "application/json" -Method GET
if( ($commit.commit.author.name -eq "nfbot") -and (($commit.commit.message -like "*[version update]*") -or ($commit.commit.message -like "***NO_CI***")) )
if( ($commit.commit.author.name -eq "nfbot") -and ($commit.commit.message -like "*[version update]*") )
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
}
Expand All @@ -53,14 +53,7 @@ jobs:
}
else
{
if($commit.commit.message -like "***NO_CI***")
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
}
else
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
}
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
}
}
Expand Down Expand Up @@ -380,15 +373,15 @@ jobs:
gem install github_changelog_generator --quiet --no-document
# need to call it passing both cache options with full path otherwise it won't work
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion"
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
displayName: Generate change log
# generate change log without future version
- powershell: |
gem install github_changelog_generator --quiet --no-document
# need to call it passing both cache options with full path otherwise it won't work
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) ) )
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) ) )
displayName: Generate change log
# push new changelog to GitHub repo
Expand All @@ -406,7 +399,7 @@ jobs:
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)"))))"
git -c http.extraheader="AUTHORIZATION: $auth" push origin "HEAD:$(Build.SourceBranchName)"
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
displayName: Push changelog to GitHub
#######################
Expand Down

0 comments on commit b714673

Please sign in to comment.