-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathpublish-prerelease.sh
More file actions
executable file
·60 lines (50 loc) · 1.84 KB
/
publish-prerelease.sh
File metadata and controls
executable file
·60 lines (50 loc) · 1.84 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
54
55
56
57
58
59
60
#!/bin/bash
set -e
# Use the first argument as version or 'v3-prerelease' if not available
version=${1:-'v4-prerelease'}
# Ensure git stage is clear
if [[ $(git status --porcelain) ]]; then
echo "Your git status is not clean. Please commit your changes before running this script.";
echo "To reset all your changes, run this instead: git reset --hard HEAD"
exit 1;
else
echo "Git status is clean. Proceeding with the script.";
fi
# From here on, if the user aborts the script, we will clean up the git stage
git_reset() {
git reset --hard HEAD
}
abort() {
echo "Aborted. Cleaning up..."
git_reset
exit 1
}
trap abort INT
# Run your commands
# Run changeset version command and capture its output
echo "Running: pnpm exec changeset version --snapshot $version"
if output=$(pnpm exec changeset version --snapshot $version 2>&1); then
if echo "$output" | grep -q "No unreleased changesets found"; then
echo "No unreleased changesets found. Exiting."
exit 0
fi
else
echo "$output"
echo "Error running changeset version command, detailed output above"
exit 1
fi
read -e -p "Pausing for manual changes, press Enter when ready to continue..."
echo "Running: pnpm run clean --filter \"@trigger.dev/*\" --filter \"trigger.dev\""
pnpm run clean --filter "@trigger.dev/*" --filter "trigger.dev"
echo "Running: pnpm run build --filter \"@trigger.dev/*\" --filter \"trigger.dev\""
pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev"
echo "Going to run: pnpm exec changeset publish --no-git-tag --snapshot --tag $version"
read -p "Do you wish to continue? (y/N): " prompt
if [[ $prompt =~ [yY](es)* ]]; then
pnpm exec changeset publish --no-git-tag --snapshot --tag $version
else
abort
fi
# If there were no errors, clear the git stage
echo "Commands ran successfully. Clearing the git stage."
git_reset