Fix update typings pipeline to work for us (#16404)

* Update publish types pipeline

* update yarn tool

* Use fork

* Remove hardcoded

* Sync up with upstream

* update email
This commit is contained in:
Charles Gagnon
2021-07-22 16:47:08 -07:00
committed by GitHub
parent ce4fa98691
commit 107023c7d0
3 changed files with 73 additions and 58 deletions

View File

@@ -11,25 +11,25 @@ steps:
inputs:
versionSpec: "14.x"
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
inputs:
versionSpec: "1.x"
- bash: |
TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
CHANNEL="G1C14HJ2F"
# - bash: |
# TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
# CHANNEL="G1C14HJ2F"
if [ "$TAG_VERSION" == "1.999.0" ]; then
MESSAGE="<!here>. Someone pushed 1.999.0 tag. Please delete it ASAP from remote and local."
# if [ "$TAG_VERSION" == "1.999.0" ]; then
# MESSAGE="<!here>. Someone pushed 1.999.0 tag. Please delete it ASAP from remote and local."
curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
-H 'Content-type: application/json; charset=utf-8' \
--data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \
https://slack.com/api/chat.postMessage
# curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
# -H 'Content-type: application/json; charset=utf-8' \
# --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \
# https://slack.com/api/chat.postMessage
exit 1
fi
displayName: Check 1.999.0 tag
# exit 1
# fi
# displayName: Check 1.999.0 tag
- bash: |
# Install build dependencies
@@ -37,47 +37,54 @@ steps:
node build/azure-pipelines/publish-types/check-version.js
displayName: Check version
# {{SQL CARBON EDIT}} Modify to fit our own scenario - specifically currently we need to use a fork of the repo since we don't
# have an account with push access to DT
- bash: |
git config --global user.email "vscode@microsoft.com"
git config --global user.name "VSCode"
git config --global user.email "azuredatastudio@microsoft.com"
git config --global user.name "Azure Data Studio"
git clone https://$(GITHUB_TOKEN)@github.com/DefinitelyTyped/DefinitelyTyped.git --depth=1
git clone https://$(GITHUB_TOKEN)@$(REPO) --depth=1
node build/azure-pipelines/publish-types/update-types.js
TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
cd DefinitelyTyped
# Sync up to latest from the DT repo
git remote add upstream https://github.com/DefinitelyTyped/DefinitelyTyped.git
git merge upstream/master
git push origin
git diff --color | cat
git add -A
git status
git checkout -b "vscode-types-$TAG_VERSION"
git commit -m "VS Code $TAG_VERSION Extension API"
git push origin "vscode-types-$TAG_VERSION"
git checkout -b "azdata-types-$TAG_VERSION"
git commit -m "Azure Data Studio $TAG_VERSION Extension API"
git push origin "azdata-types-$TAG_VERSION"
displayName: Push update to DefinitelyTyped
- bash: |
TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
CHANNEL="G1C14HJ2F"
# - bash: |
# TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
# CHANNEL="G1C14HJ2F"
MESSAGE="DefinitelyTyped/DefinitelyTyped#vscode-types-$TAG_VERSION created. Endgame champion, please open this link, examine changes and create a PR:"
LINK="https://github.com/DefinitelyTyped/DefinitelyTyped/compare/vscode-types-$TAG_VERSION?quick_pull=1&body=Updating%20VS%20Code%20Extension%20API.%20See%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode%2Fissues%2F70175%20for%20details."
MESSAGE2="[@eamodio, @jrieken, @kmaetzel, @egamma]. Please review and merge PR to publish @types/vscode."
# MESSAGE="DefinitelyTyped/DefinitelyTyped#vscode-types-$TAG_VERSION created. Endgame champion, please open this link, examine changes and create a PR:"
# LINK="https://github.com/DefinitelyTyped/DefinitelyTyped/compare/vscode-types-$TAG_VERSION?quick_pull=1&body=Updating%20VS%20Code%20Extension%20API.%20See%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode%2Fissues%2F70175%20for%20details."
# MESSAGE2="[@eamodio, @jrieken, @kmaetzel, @egamma]. Please review and merge PR to publish @types/vscode."
curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
-H 'Content-type: application/json; charset=utf-8' \
--data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \
https://slack.com/api/chat.postMessage
# curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
# -H 'Content-type: application/json; charset=utf-8' \
# --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \
# https://slack.com/api/chat.postMessage
curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
-H 'Content-type: application/json; charset=utf-8' \
--data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$LINK"'"}' \
https://slack.com/api/chat.postMessage
# curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
# -H 'Content-type: application/json; charset=utf-8' \
# --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$LINK"'"}' \
# https://slack.com/api/chat.postMessage
curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
-H 'Content-type: application/json; charset=utf-8' \
--data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE2"'"}' \
https://slack.com/api/chat.postMessage
# curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \
# -H 'Content-type: application/json; charset=utf-8' \
# --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE2"'"}' \
# https://slack.com/api/chat.postMessage
displayName: Send message on Slack
# displayName: Send message on Slack

View File

@@ -13,11 +13,11 @@ try {
.execSync('git describe --tags `git rev-list --tags --max-count=1`')
.toString()
.trim();
const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`;
const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts');
const dtsUri = `https://raw.githubusercontent.com/microsoft/azuredatastudio/${tag}/src/sql/azdata.d.ts`; // {{SQL CARBON EDIT}} Use our typings
const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/azdata/index.d.ts'); // {{SQL CARBON EDIT}} Use our typings
cp.execSync(`curl ${dtsUri} --output ${outPath}`);
updateDTSFile(outPath, tag);
console.log(`Done updating vscode.d.ts at ${outPath}`);
console.log(`Done updating azdata.d.ts at ${outPath}`); // {{SQL CARBON EDIT}} Use our typings
}
catch (err) {
console.error(err);
@@ -51,21 +51,25 @@ function getNewFileContent(content, tag) {
function getNewFileHeader(tag) {
const [major, minor] = tag.split('.');
const shorttag = `${major}.${minor}`;
// {{SQL CARBON EDIT}} Use our own header
const header = [
`// Type definitions for Visual Studio Code ${shorttag}`,
`// Project: https://github.com/microsoft/vscode`,
`// Definitions by: Visual Studio Code Team, Microsoft <https://github.com/Microsoft>`,
`// Type definitions for Azure Data Studio ${shorttag}`,
`// Project: https://github.com/microsoft/azuredatastudio`,
`// Definitions by: Charles Gagnon <https://github.com/Charles-Gagnon>`,
`// Alan Ren: <https://github.com/alanrenmsft>`,
`// Karl Burtram: <https://github.com/kburtram>`,
`// Ken Van Hyning: <https://github.com/kenvanhyning>`,
`// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`,
``,
`/*---------------------------------------------------------------------------------------------`,
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
` * Licensed under the Source EULA.`,
` * See https://github.com/Microsoft/vscode/blob/main/LICENSE.txt for license information.`,
` * Licensed under the MIT License.`,
` * See https://github.com/Microsoft/azuredatastudio/blob/main/LICENSE.txt for license information.`,
` *--------------------------------------------------------------------------------------------*/`,
``,
`/**`,
` * Type Definition for Visual Studio Code ${shorttag} Extension API`,
` * See https://code.visualstudio.com/api for more information`,
` * Type Definition for Azure Data Studio ${shorttag} Extension API`,
` * See https://docs.microsoft.com/sql/azure-data-studio/extensibility-apis for more information`,
` */`
].join('\n');
return header;

View File

@@ -16,13 +16,13 @@ try {
.toString()
.trim();
const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`;
const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts');
const dtsUri = `https://raw.githubusercontent.com/microsoft/azuredatastudio/${tag}/src/sql/azdata.d.ts`; // {{SQL CARBON EDIT}} Use our typings
const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/azdata/index.d.ts'); // {{SQL CARBON EDIT}} Use our typings
cp.execSync(`curl ${dtsUri} --output ${outPath}`);
updateDTSFile(outPath, tag);
console.log(`Done updating vscode.d.ts at ${outPath}`);
console.log(`Done updating azdata.d.ts at ${outPath}`); // {{SQL CARBON EDIT}} Use our typings
} catch (err) {
console.error(err);
console.error('Failed to update types');
@@ -63,21 +63,25 @@ function getNewFileHeader(tag: string) {
const [major, minor] = tag.split('.');
const shorttag = `${major}.${minor}`;
// {{SQL CARBON EDIT}} Use our own header
const header = [
`// Type definitions for Visual Studio Code ${shorttag}`,
`// Project: https://github.com/microsoft/vscode`,
`// Definitions by: Visual Studio Code Team, Microsoft <https://github.com/Microsoft>`,
`// Type definitions for Azure Data Studio ${shorttag}`,
`// Project: https://github.com/microsoft/azuredatastudio`,
`// Definitions by: Charles Gagnon <https://github.com/Charles-Gagnon>`,
`// Alan Ren: <https://github.com/alanrenmsft>`,
`// Karl Burtram: <https://github.com/kburtram>`,
`// Ken Van Hyning: <https://github.com/kenvanhyning>`,
`// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`,
``,
`/*---------------------------------------------------------------------------------------------`,
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
` * Licensed under the Source EULA.`,
` * See https://github.com/Microsoft/vscode/blob/main/LICENSE.txt for license information.`,
` * Licensed under the MIT License.`,
` * See https://github.com/Microsoft/azuredatastudio/blob/main/LICENSE.txt for license information.`,
` *--------------------------------------------------------------------------------------------*/`,
``,
`/**`,
` * Type Definition for Visual Studio Code ${shorttag} Extension API`,
` * See https://code.visualstudio.com/api for more information`,
` * Type Definition for Azure Data Studio ${shorttag} Extension API`,
` * See https://docs.microsoft.com/sql/azure-data-studio/extensibility-apis for more information`,
` */`
].join('\n');