-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·53 lines (41 loc) · 1.4 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.4 KB
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
#!/bin/bash
set -e
if ! command -v vsce &> /dev/null; then
echo "✗ vsce not found. Run: npm install -g @vscode/vsce"
exit 1
fi
read -p "change version to: " VERSION
read -p "commit message (default: release v$VERSION): " COMMIT_MESSAGE
read -p "changelog entry (what changed in this version): " CHANGELOG_ENTRY
COMMIT_MESSAGE=${COMMIT_MESSAGE:-"release v$VERSION"}
DATE=$(date +%Y-%m-%d)
ENTRY="## v$VERSION — $DATE\n\n$CHANGELOG_ENTRY\n\n"
echo -e "$ENTRY$(cat CHANGELOG.md 2>/dev/null)" > CHANGELOG.md
echo "→ updating versions..."
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" npm/package.json
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" vscode_ext/package.json
echo "→ packaging VS Code extension..."
cd vscode_ext
vsce package --out slay-lang-$VERSION.vsix
cd ..
echo "→ copying vsix to npm/..."
cp vscode_ext/slay-lang-$VERSION.vsix npm/slay-lang-$VERSION.vsix
echo "→ removing old vsix files..."
find npm -name "slay-lang-*.vsix" ! -name "slay-lang-$VERSION.vsix" -delete
echo "→ syncing src/ into npm/..."
rm -rf npm/src
cp -r src npm/src
echo "→ publishing to npm..."
cd npm
npm publish
cd ..
echo "→ cleaning up..."
rm -rf npm/src
rm -f npm/slay-lang-$VERSION.vsix
rm -f vscode_ext/slay-lang-$VERSION.vsix
echo "→ tagging release..."
git add -A
git commit -m "$COMMIT_MESSAGE"
git tag v$VERSION
git push && git push --tags
echo "✓ slaylang@$VERSION shipped"