/
release.sh
46 lines (34 loc) · 1.15 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
# Release the package. Make sure the CHANGELOG is up-to-date before running.
main() (
newVersion="${1?Missing new version parameter}"
newTag="v${newVersion}"
[[ "${newVersion}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
printf 'The version must comply with semver\n'
return 1
}
cd "$(git rev-parse --show-toplevel)"
rm -rf ./dist || true
yarn version "--new-version=${newVersion}"
yarn run package
vsixFile="markdown-spec-formatter-${newVersion}.vsix"
code --install-extension "${vsixFile}"
printf 'Try the extension (temporarily installed in VSCode) then type Y if it works or N to abort\n'
read -r answer
if [[ "${answer^^}" == 'Y' ]]; then
code --uninstall-extension "${vsixFile}"
uploadLocation='https://marketplace.visualstudio.com/manage/publishers/quilicicf'
printf 'You are ready to go, now upload %s here: %s\n' "${vsixFile}" "${uploadLocation}"
printf 'When you are done, type ENTER\n'
read -r
git push origin 'master'
git push --tags
rm "${vsixFile}"
printf 'You are all good!\n'
else
git tag --delete "${newTag}"
git reset HEAD~1 --hard
fi
)
main "$@"