2024-08-14 12:22:13 +08:00
|
|
|
#!/usr/bin/env bash
|
2022-05-14 15:18:30 +08:00
|
|
|
set -ex
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2021-07-05 11:26:38 +08:00
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2022-05-14 15:18:30 +08:00
|
|
|
SOURCE_DIR="$(git -C $DIR rev-parse --show-toplevel)"
|
|
|
|
if [ -z "$TARGET_DIR" ]; then
|
|
|
|
TARGET_DIR="$(mktemp -d)"
|
|
|
|
fi
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2021-07-05 11:26:38 +08:00
|
|
|
# set git identity
|
|
|
|
source $DIR/identity.sh
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2022-10-01 03:24:56 +08:00
|
|
|
echo "[-] Setting up target repo T=$SECONDS"
|
2022-05-14 15:18:30 +08:00
|
|
|
|
|
|
|
rm -rf $TARGET_DIR
|
|
|
|
mkdir -p $TARGET_DIR
|
|
|
|
cd $TARGET_DIR
|
|
|
|
cp -r $SOURCE_DIR/.git $TARGET_DIR
|
|
|
|
pre-commit uninstall || true
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2021-07-05 11:26:38 +08:00
|
|
|
echo "[-] bringing master-ci and devel in sync T=$SECONDS"
|
2020-01-31 05:06:45 +08:00
|
|
|
cd $TARGET_DIR
|
2023-12-07 09:22:32 +08:00
|
|
|
|
2022-10-17 06:54:36 +08:00
|
|
|
git fetch --depth 1 origin master-ci
|
|
|
|
git fetch --depth 1 origin devel
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2020-07-04 10:12:05 +08:00
|
|
|
git checkout -f --track origin/master-ci
|
2020-01-31 05:06:45 +08:00
|
|
|
git reset --hard master-ci
|
|
|
|
git checkout master-ci
|
|
|
|
git reset --hard origin/devel
|
2022-09-29 07:33:42 +08:00
|
|
|
git clean -xdff
|
2022-05-14 15:18:30 +08:00
|
|
|
git lfs uninstall
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2020-06-26 06:19:48 +08:00
|
|
|
# remove everything except .git
|
2020-01-31 05:06:45 +08:00
|
|
|
echo "[-] erasing old openpilot T=$SECONDS"
|
2020-06-26 06:19:48 +08:00
|
|
|
find . -maxdepth 1 -not -path './.git' -not -name '.' -not -name '..' -exec rm -rf '{}' \;
|
2020-02-12 02:13:21 +08:00
|
|
|
|
2021-07-05 11:26:38 +08:00
|
|
|
# reset source tree
|
2020-01-31 05:06:45 +08:00
|
|
|
cd $SOURCE_DIR
|
2022-09-29 07:33:42 +08:00
|
|
|
git clean -xdff
|
2020-01-31 05:06:45 +08:00
|
|
|
|
|
|
|
# do the files copy
|
|
|
|
echo "[-] copying files T=$SECONDS"
|
|
|
|
cd $SOURCE_DIR
|
2024-05-26 09:47:16 +08:00
|
|
|
cp -pR --parents $(./release/release_files.py) $TARGET_DIR/
|
2021-04-12 06:05:14 +08:00
|
|
|
|
2020-01-31 05:06:45 +08:00
|
|
|
# in the directory
|
|
|
|
cd $TARGET_DIR
|
2020-02-04 07:01:36 +08:00
|
|
|
rm -f panda/board/obj/panda.bin.signed
|
|
|
|
|
2022-05-17 09:53:02 +08:00
|
|
|
# include source commit hash and build date in commit
|
|
|
|
GIT_HASH=$(git --git-dir=$SOURCE_DIR/.git rev-parse HEAD)
|
|
|
|
DATETIME=$(date '+%Y-%m-%dT%H:%M:%S')
|
2022-05-19 05:11:57 +08:00
|
|
|
VERSION=$(cat $SOURCE_DIR/common/version.h | awk -F\" '{print $2}')
|
2022-05-17 09:53:02 +08:00
|
|
|
|
2020-01-31 05:06:45 +08:00
|
|
|
echo "[-] committing version $VERSION T=$SECONDS"
|
|
|
|
git add -f .
|
|
|
|
git status
|
2022-05-17 09:53:02 +08:00
|
|
|
git commit -a -m "openpilot v$VERSION release
|
|
|
|
|
|
|
|
date: $DATETIME
|
|
|
|
master commit: $GIT_HASH
|
|
|
|
"
|
2020-01-31 05:06:45 +08:00
|
|
|
|
2024-06-02 05:23:48 +08:00
|
|
|
# should be no submodules or LFS files
|
|
|
|
git submodule status
|
|
|
|
if [ ! -z "$(git lfs ls-files)" ]; then
|
|
|
|
echo "LFS files detected!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-08-09 05:16:47 +08:00
|
|
|
# ensure files are within GitHub's limit
|
|
|
|
BIG_FILES="$(find . -type f -not -path './.git/*' -size +95M)"
|
|
|
|
if [ ! -z "$BIG_FILES" ]; then
|
|
|
|
printf '\n\n\n'
|
|
|
|
echo "Found files exceeding GitHub's 100MB limit:"
|
|
|
|
echo "$BIG_FILES"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-05-14 15:18:30 +08:00
|
|
|
if [ ! -z "$BRANCH" ]; then
|
|
|
|
echo "[-] Pushing to $BRANCH T=$SECONDS"
|
|
|
|
git push -f origin master-ci:$BRANCH
|
2020-01-31 05:06:45 +08:00
|
|
|
fi
|
|
|
|
|
2022-05-14 15:18:30 +08:00
|
|
|
echo "[-] done T=$SECONDS, ready at $TARGET_DIR"
|