Skip to content

Commit

Permalink
ota: ci: added another safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovix92 committed Apr 17, 2021
1 parent 2dddb20 commit 9a2ad95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
11 changes: 7 additions & 4 deletions helpers/latest_device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
git clone https://github.com/RevengeOS-Devices/official_devices official_devices

cd official_devices
LIST=$(git diff-tree --no-commit-id --name-only -r HEAD)
echo $LIST > temp
sed 's|/.*||' -i temp
git diff-tree --no-commit-id --name-only -r HEAD | sed 's|/.*||' > temp
DEVICE=$(cat temp)
for i in $(cat temp); do
if [ "$i" == "maintainers.json" ]; then
DEVICE=maintainers.json
echo $DEVICE
fi
done
cd ..
rm -rf official_devices
echo $DEVICE
export DEVICE
18 changes: 5 additions & 13 deletions push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,17 @@ source $(pwd)/helpers/push_helpers.sh
# Export TARGET_DEVICE from last updated device inside official_devices
TARGET_DEVICE=$(bash $(pwd)/helpers/latest_device.sh)

# Just a lil safety check
FLAG=$(cat file)
if [ "$FLAG" == "0" ]; then
tg_groupcast "Not pushing, only core files updated."
exit
fi

# Abort if TARGET_DEVICE equals to changelog.txt or maintainers.json
if [ "$TARGET_DEVICE" == "maintainers.json" ] || [ "$TARGET_DEVICE" == "changelog.txt" ]; then
tg_groupcast "Only maintainers.json or changelog.txt has been updated. Ignoring."
exit
fi

# Another safety check
if [ "$DEVICE" == "$TARGET_DEVICE" ]; then
echo "Continuing, safety check passed."
else
tg_groupcast "Something's wrong with the script. Device: ${DEVICE}, Target device: ${TARGET_DEVICE}."
exit
# Just a lil safety check
FLAG=$(cat file)
if [ "$FLAG" == "0" ]; then
tg_groupcast "Not pushing, only core files updated."
exit
fi

# Fetch device.json from our github repo
Expand Down

0 comments on commit 9a2ad95

Please sign in to comment.