forked from triggerdotdev/trigger.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-release.sh
More file actions
executable file
·51 lines (38 loc) · 1.13 KB
/
publish-release.sh
File metadata and controls
executable file
·51 lines (38 loc) · 1.13 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
#!/bin/bash
set -euo pipefail
token="${NODE_AUTH_TOKEN:-${GITHUB_TOKEN:-${GH_TOKEN:-}}}"
if [[ -z "$token" ]] && command -v gh >/dev/null 2>&1; then
token="$(gh auth token 2>/dev/null || true)"
fi
if [[ -z "$token" ]]; then
echo "Missing auth token. Set NODE_AUTH_TOKEN, GITHUB_TOKEN, or GH_TOKEN."
exit 1
fi
if [[ $(git status --porcelain) ]]; then
echo "Your git status is not clean. Commit/stash changes before publishing."
exit 1
fi
npmrc_file=$(mktemp)
cleanup() {
rm -f "$npmrc_file"
}
trap cleanup EXIT
cat > "$npmrc_file" <<EOF
@basicblock:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${token}
EOF
export npm_config_userconfig="$npmrc_file"
export NODE_AUTH_TOKEN="$token"
echo "Running: pnpm install --frozen-lockfile"
pnpm install --frozen-lockfile
echo "Running: pnpm run generate"
pnpm run generate
echo "Running: pnpm run build --filter \"@basicblock/trigger-*\""
pnpm run build --filter "@basicblock/trigger-*"
echo "Going to run: pnpm exec changeset publish"
read -p "Continue? (y/N): " prompt
if [[ ! $prompt =~ [yY](es)* ]]; then
echo "Aborted."
exit 1
fi
pnpm exec changeset publish