-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathdeploy-cursorless-talon.sh
More file actions
executable file
·48 lines (35 loc) · 2.09 KB
/
Copy pathdeploy-cursorless-talon.sh
File metadata and controls
executable file
·48 lines (35 loc) · 2.09 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
#!/usr/bin/env bash
# This script is used to push the cursorless-talon subtree to the cursorless
# talon repo. We proceed by first performing a git subtree split and then
# cherrypicking any new commits onto the cursorless-talon main branch
set -euo pipefail
: "${DEPLOY_SHA:?DEPLOY_SHA must be set}"
# Check out staging branch
git switch -c cursorless-talon-staging origin/cursorless-talon-staging
# Exit if there were no changes to the cursorless-talon directory
[[ "$(git rev-parse "${DEPLOY_SHA}:cursorless-talon")" == "$(git rev-parse 'cursorless-talon-staging^{tree}')" ]] && exit 0
# Fetch current cursorless-talon main
git remote add cursorless-talon 'https://github.com/cursorless-dev/cursorless-talon.git'
git fetch cursorless-talon
# Sanity check that cursorless-talon/main is identical to cursorless-talon-staging
[[ "$(git rev-parse 'cursorless-talon/main^{tree}')" == "$(git rev-parse 'cursorless-talon-staging^{tree}')" ]]
# Tag previous version of staging branch
git tag cursorless-talon-staging-previous cursorless-talon-staging
# Update the staging branch
git switch -c github-sha "$DEPLOY_SHA"
git subtree split --prefix=cursorless-talon --branch=cursorless-talon-staging
# Sanity check that the previous staging commit is an ancestor of the new one
git merge-base --is-ancestor cursorless-talon-staging-previous cursorless-talon-staging
# Checkout and cherry-pick commits onto cursorless-talon/main
git switch -c cursorless-talon-main cursorless-talon/main
git cherry-pick cursorless-talon-staging-previous..cursorless-talon-staging
# Sanity check that cursorless-talon-main is identical to cursorless-talon-staging
[[ "$(git rev-parse 'cursorless-talon-main^{tree}')" == "$(git rev-parse 'cursorless-talon-staging^{tree}')" ]]
# Sanity check that cursorless-talon-main is identical to cursorless-talon
# subdirectory of cursorless-vscode
[[ "$(git rev-parse 'cursorless-talon-main^{tree}')" == "$(git rev-parse "${DEPLOY_SHA}:cursorless-talon")" ]]
# Push to cursorless-talon
git push cursorless-talon cursorless-talon-main:main
# Checkout and push staging branch
git switch cursorless-talon-staging
git push