Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Use pipeline to update gather-docs.yaml during releases #7546

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions common/config/azure-pipelines/jobs/check-gather-docs.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: check-gather-docs
trigger: none
# name: check-gather-docs
# trigger: none

resources:
pipelines:
- pipeline: 'itwinjs'
source: iTwin.js/iTwin.js
trigger:
enabled: true
branches:
include:
- release/*
tags:
- 'package-release'
# resources:
# pipelines:
# - pipeline: 'itwinjs'
# source: iTwin.js/iTwin.js
# trigger:
# enabled: true
# branches:
# include:
# - release/*
# tags:
# - 'package-release'

jobs:
- job: check-gather-docs
displayName: 'Check and update gather-docs.yaml branch'
pool:
vmImage: 'ubuntu-latest'
# jobs:
# - job: check-gather-docs
# displayName: 'Check and update gather-docs.yaml branch'
# pool:
# vmImage: 'ubuntu-latest'

variables:
- group: imodel-native-secret-variables
# variables:
# - group: imodel-native-secret-variables

steps:
- checkout: self
persistCredentials: true
clean: true
# steps:
# - checkout: self
# persistCredentials: true
# clean: true

- script: |
node common/scripts/check_gather_docs.mjs
git add .
git commit -m "Update gather-docs.yaml"
git push --set-upstream https://$(GH_TOKEN)@github.com/iTwin/itwinjs-core $(Build.SourceBranchName)
displayName: 'Check gather-docs.yaml branch'
env:
GITHUB_TOKEN: $(GH_TOKEN)
CURRENT_BRANCH: $(Build.SourceBranch)
# - script: |
# node common/scripts/check_gather_docs.mjs
# git add .
# git commit -m "Update gather-docs.yaml"
# git push --set-upstream https://$(GH_TOKEN)@github.com/iTwin/itwinjs-core $(Build.SourceBranchName)
# displayName: 'Check gather-docs.yaml branch'
# env:
# GITHUB_TOKEN: $(GH_TOKEN)
# CURRENT_BRANCH: $(Build.SourceBranch)
11 changes: 11 additions & 0 deletions common/config/azure-pipelines/templates/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ steps:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/imodeljs/packages'
ArtifactName: packages
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'Schedule', 'Manual'), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['ShouldPublish'], 'True'))

- script: |
node common/scripts/check_gather_docs.mjs
git add .
git commit -m "Update gather-docs.yaml"
git push --set-upstream https://$(GH_TOKEN)@github.com/iTwin/itwinjs-core $(Build.SourceBranchName)
displayName: 'Check gather-docs.yaml branch'
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'Schedule', 'Manual'), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['ShouldPublish'], 'True'))
env:
GITHUB_TOKEN: $(GH_TOKEN)
CURRENT_BRANCH: $(Build.SourceBranch)
7 changes: 7 additions & 0 deletions common/scripts/check_gather_docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ function checkFile(filePath, currentBranch) {
function main() {
const filePath = path.normalize("./common/config/azure-pipelines/templates/gather-docs.yaml")
const currentBranch = process.env.CURRENT_BRANCH;
MichaelSwigerAtBentley marked this conversation as resolved.
Show resolved Hide resolved

const textToFind = /refs\/heads\/release\/\d+\.\d+\.x/gi;
if (!currentBranch.match(textToFind)) {
console.error("Invalid branch name.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this message should be more specific: "current branch name does not match the expected format"

process.exit(1);
}

checkFile(filePath, currentBranch);
}
main();
Expand Down