1
1
#! /usr/bin/env bash
2
+ set -exuo pipefail
2
3
3
4
# This script pushes the contents of the `deno`` directory to the `deno` branch,
4
5
# and creates a `vx.x.x-deno` tag, so that Deno users can
10
11
# - Set the following environment variables when running this script:
11
12
# - DENO_PUSH_REMOTE_URL - the remote url of the separate GitHub repo
12
13
# - DENO_PUSH_BRANCH - the branch you want to push to in that repo (probably `main`)
14
+ # - DENO_MAIN_BRANCH - the branch you want as the main branch in that repo (probably `main`, sometimes `master`)
13
15
# - DENO_PUSH_VERSION - defaults to version in package.json
14
16
# - DENO_PUSH_RELEASE_TAG - defaults to v$DENO_PUSH_VERSION-deno
15
17
@@ -18,8 +20,6 @@ die () {
18
20
exit 1
19
21
}
20
22
21
- set -exuo pipefail
22
-
23
23
# Allow caller to set the following environment variables, but provide defaults
24
24
# if unset
25
25
# : "${FOO:=bar}" sets FOO=bar unless it's set and non-empty
@@ -28,8 +28,15 @@ set -exuo pipefail
28
28
29
29
: " ${DENO_PUSH_VERSION:= $(node -p ' require("./package.json").version' )} "
30
30
: " ${DENO_PUSH_BRANCH:= deno} "
31
+ : " ${DENO_MAIN_BRANCH:= main} "
31
32
: " ${DENO_PUSH_REMOTE_URL:= $(git remote get-url origin)} "
32
- : " ${DENO_PUSH_RELEASE_TAG:= " v$DENO_PUSH_VERSION -deno" } "
33
+ : " ${DENO_GIT_USER_NAME:= " Stainless Bot" } "
34
+ : " ${DENO_GIT_USER_NAME:= " bot@stainlessapi.com" } "
35
+ if [[ $DENO_PUSH_BRANCH = " deno" ]]; then
36
+ : " ${DENO_PUSH_RELEASE_TAG:= " v$DENO_PUSH_VERSION -deno" } "
37
+ else
38
+ : " ${DENO_PUSH_RELEASE_TAG:= " v$DENO_PUSH_VERSION " } "
39
+ fi
33
40
34
41
if [ ! -e deno ]; then ./build; fi
35
42
@@ -41,7 +48,7 @@ if [ ! -e deno ]; then ./build; fi
41
48
42
49
cd deno
43
50
rm -rf .git
44
- git init
51
+ git init -b " $DENO_MAIN_BRANCH "
45
52
git remote add origin " $DENO_PUSH_REMOTE_URL "
46
53
if git fetch origin " $DENO_PUSH_RELEASE_TAG " ; then
47
54
die " Tag $DENO_PUSH_RELEASE_TAG already exists"
56
63
# the branch doesn't exist on the remote yet
57
64
git checkout -b " $DENO_PUSH_BRANCH "
58
65
fi
66
+
67
+ git config user.email " $DENO_GIT_USER_EMAIL "
68
+ git config user.name " $DENO_GIT_USER_NAME "
69
+
59
70
git add .
60
71
git commit -m " chore(deno): release $DENO_PUSH_VERSION "
61
72
git tag -a " $DENO_PUSH_RELEASE_TAG " -m " release $DENO_PUSH_VERSION "
0 commit comments