Skip to content

Commit cdf1b98

Browse files
committed
Working on publish back to github
1 parent 8c00921 commit cdf1b98

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

azure-pipelines.yml

+26
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,34 @@ pool:
55
vmImage: 'ubuntu-latest'
66

77
steps:
8+
- task: DownloadSecureFile@1
9+
inputs:
10+
secureFile: vscode_typescript_next_deploy_key
11+
displayName: 'Get the deploy key'
12+
813
- script: |
914
set -e
15+
1016
chmod +x ./build/bumpAndPublish.sh
1117
./build/bumpAndPublish.sh "$(marketplace_key)"
18+
result=$?
19+
20+
if [ $result -eq 0 ]; then
21+
git config --local user.name "Azure Pipelines"
22+
git config --local user.email "[email protected]"
23+
git add .
24+
git commit -m "Publishing version bump ***NO_CI***"
25+
26+
mkdir ~/.ssh && mv $DOWNLOADSECUREFILE_SECUREFILEPATH ~/.ssh/id_rsa
27+
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
28+
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
29+
git remote set-url --push origin [email protected]:microsoft/vscode-typescript-next.git
30+
git push origin HEAD:master
31+
32+
exit
33+
elif [ $result -eq 1 ]; then
34+
exit
35+
else
36+
exit $result
37+
fi
1238
displayName: 'Publish to marketplace'

build/bumpAndPublish.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
npm run bump-version
33
result=$?
44

5+
EXPECTED_ERROR_CODE=1
6+
UNEXPECTED_ERROR_CODE=2
7+
58
if [ $result -eq 0 ]; then
69
output="$(npx vsce publish $f --pat $1 --noVerify 2>&1)"
710
publishResult=$?
@@ -10,15 +13,15 @@ if [ $result -eq 0 ]; then
1013
exit
1114
elif [[ $output =~ "already exists" ]]; then
1215
echo "Publish failed but expected. Skipping publishing same version."
13-
exit
16+
exit $EXPECTED_ERROR_CODE
1417
else
1518
echo "Error publishing"
16-
exit 1
19+
exit $UNEXPECTED_ERROR_CODE
1720
fi;
1821
elif [ $result -eq 1 ]; then
1922
echo "Skipping publishing same version"
20-
exit
23+
exit $EXPECTED_ERROR_CODE
2124
else
2225
echo "Error. Exited with $result"
23-
exit 1
26+
exit $UNEXPECTED_ERROR_CODE
2427
fi

0 commit comments

Comments
 (0)