first commit
This commit is contained in:
33
node_modules/@vector-im/matrix-bot-sdk/scripts/fetch-remotes
generated
vendored
Executable file
33
node_modules/@vector-im/matrix-bot-sdk/scripts/fetch-remotes
generated
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
for REMOTE in $(git remote); do
|
||||
URL=$(git remote get-url $REMOTE)
|
||||
if [[ $URL =~ "turt2live" ]]; then
|
||||
UPSTREAM_REPO=$REMOTE
|
||||
elif [[ $URL =~ "vector-im" ]]; then
|
||||
FORK_REPO=$REMOTE
|
||||
fi
|
||||
done
|
||||
|
||||
function echoAndDo {
|
||||
echo "$*"
|
||||
$*
|
||||
}
|
||||
|
||||
if [[ -z $UPSTREAM_REPO ]]; then
|
||||
echo -n 'Adding remote for upstream repo: '
|
||||
UPSTREAM_REPO=turt2live
|
||||
echoAndDo git remote add $UPSTREAM_REPO git@github.com:turt2live/matrix-bot-sdk.git
|
||||
fi
|
||||
|
||||
if [[ -z $FORK_REPO ]]; then
|
||||
echo -n 'Adding remote for fork repo: '
|
||||
FORK_REPO=vector-im
|
||||
echoAndDo git remote add $FORK_REPO git@github.com:vector-im/matrix-bot-sdk.git
|
||||
fi
|
||||
|
||||
for REPO in $UPSTREAM_REPO $FORK_REPO; do
|
||||
git fetch $REPO >/dev/null
|
||||
git remote set-head $REPO -a >/dev/null
|
||||
done
|
14
node_modules/@vector-im/matrix-bot-sdk/scripts/prepare-patch-branch
generated
vendored
Executable file
14
node_modules/@vector-im/matrix-bot-sdk/scripts/prepare-patch-branch
generated
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo 'Please provide a title for your patch branch' >&2
|
||||
exit 1
|
||||
fi
|
||||
PATCH_TITLE=$1
|
||||
|
||||
. $(dirname $0)/fetch-remotes
|
||||
|
||||
git checkout -b $PATCH_TITLE $(git merge-base $UPSTREAM_REPO $FORK_REPO)
|
||||
|
||||
echo "Branch '$PATCH_TITLE' is now ready. Push changes to this branch when preparing a PR, and aim to merge it to both upstream and the fork."
|
50
node_modules/@vector-im/matrix-bot-sdk/scripts/tag-release
generated
vendored
Executable file
50
node_modules/@vector-im/matrix-bot-sdk/scripts/tag-release
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
echo 'Working dir is dirty, aborting' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $(dirname $0)/fetch-remotes
|
||||
|
||||
git checkout element-release
|
||||
git reset --hard $FORK_REPO
|
||||
|
||||
PREID=element
|
||||
|
||||
# The latest upstream release tag reachable from the current commit
|
||||
PREV_UPST_TAG=$(git log --decorate=short --decorate-refs=refs/tags/ --simplify-by-decoration --oneline | awk '/ \(tag: / && !/beta|element/ {sub(/)$/, "", $3); print $3; exit}')
|
||||
|
||||
# The commit hash of the retrieved tag (not of the tag itself)
|
||||
PREV_UPST_TAG_HASH=$(git rev-parse ${PREV_UPST_TAG}~0)
|
||||
|
||||
# The immediate child commit of the release commit,
|
||||
# to consider the 'Revert version back to "develop"' commits
|
||||
PREV_UPST_NXT_HASH=$(git rev-list ${PREV_UPST_TAG}..${UPSTREAM_REPO} | tail -n 1)
|
||||
|
||||
# Check if the current branch is a direct merge of the previous upstream release
|
||||
for MERGE_PARENT in $(git show -s | awk '/^Merge: / {print $2; print $3; exit}'); do
|
||||
if [[ $PREV_UPST_TAG_HASH =~ ^$MERGE_PARENT || $PREV_UPST_NXT_HASH =~ ^$MERGE_PARENT ]]; then
|
||||
RELEASE_MERGE=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $RELEASE_MERGE -eq 1 ]]; then
|
||||
THIS_TAG="${PREV_UPST_TAG}-${PREID}"
|
||||
THIS_VER=${THIS_TAG#v}
|
||||
else
|
||||
THIS_VER=$(npx semver --preid ${PREID} -i prerelease ${PREV_UPST_TAG#v})
|
||||
while [[ -n $(git tag -l "v${THIS_VER}") ]]; do
|
||||
THIS_VER=$(npx semver --preid ${PREID} -i prerelease $THIS_VER)
|
||||
done
|
||||
THIS_TAG="v${THIS_VER}"
|
||||
fi
|
||||
|
||||
sed -i 's/\("version": "\).*\("\)/\1'$THIS_VER'\2/' package.json
|
||||
git add package.json
|
||||
git commit -m $THIS_TAG
|
||||
git tag -sm $THIS_TAG{,}
|
||||
|
||||
echo "Tag '$THIS_TAG' is now ready and may be pushed"
|
Reference in New Issue
Block a user