๐Ÿ“ฆ phil294 / SQLite-Runner-LSP

๐Ÿ“„ release.sh ยท 117 lines
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117#!/bin/bash
set -e
set -o pipefail

pause() {
    read -r -n 1 -s -p 'Press any key to continue. . .'
    echo
}

run() {
    while :; do
        echo "Running: $*" >&2
        local status=0
        bash -c "$*" || status=$?
        [[ $status == 0 ]] && break
        echo "Failed" >&2
        read -r -n 1 -s -p 'Press any key to retry or Ctrl+C to exit'
        echo
    done
}

echo update readme
pause

if ! [ -z "$(git status --porcelain)" ]; then
    echo 'git working tree not clean'
    pause
    # exit 1
fi

run git push --tags origin master --dry-run

run npx vsce verify-pat
# pause

: ''
run npx ncu -u # -x '@types/vscode'
run npm i
run git add package.json package-lock.json
run git commit -m 'dependencies-upgrade'
echo 'deps upgraded'
pause
# '

echo test
pause

vscodium --extensionDevelopmentPath="$PWD" --disable-extensions
pause
pause

# git fetch
# changes=$(git log --reverse "$(git describe --tags --abbrev=0)".. --pretty=format:"%h___%B" |grep . |sed -E 's/^([0-9a-f]{6,})___(.)/- [`\1`](https:\/\/github.com\/phil294\/search++\/commit\/\1) \U\2/')

# echo edit changelog
# pause
# changes=$(micro <<< "$changes")
# [ -z "$changes" ] && echo 'no changes. will skip creating gh release but package anyway.' && pause
# echo changes:
# echo "$changes"

version=$(npm version patch --no-git-tag-version)
# version=v0.0.2
echo version: $version
pause

# ! [ -z "$changes" ] && \
#     sed -i $'/<!-- CHANGELOG_PLACEHOLDER -->/r'<(echo $'\n### '${version} $(date +"%Y-%m-%d")$'\n\n'"$changes") CHANGELOG.md

run git add package.json package-lock.json # README.md
# ! [ -z "$changes" ] && \
#     run git add CHANGELOG.md
run git commit -m "$version"
run git tag "$version"
echo 'patched package.json version patch, updated changelog, committed, tagged'
pause

run npx vsce package
vsix_file=$(ls -tr sqlite-runner-lsp-*.vsix* |tail -1)
mv "$vsix_file" vsix-out/"$vsix_file"
vsix_file=vsix-out/"$vsix_file"
echo $vsix_file

run xdg-open "${vsix_file@Q}"
ls -hltr vsix-out
ls -hltr
echo 'check vsix package before publish'
pause
pause

echo 'install vsix and test'
pause
pause

run npx vsce publish
echo 'vsce published'
pause

run npx ovsx publish "$vsix_file" -p "$(cat ~/.open-vsx-access-token)"
echo 'ovsx published'
pause

run git push --tags origin master

# if [[ -z $version || -z $vsix_file ]]; then
#     echo version/changes empty
#     exit 1
# fi

# if ! [ -z "$changes" ]; then
#     echo 'will create github release'
#     pause
#     run gh release create "$version" --target master --title "$version" --notes "${changes@Q}" --verify-tag "${vsix_file@Q}"
#     echo 'github release created'
# else
#     echo 'skipping github release creation since no changes'
# fi