Skip to content

Commit d06207d

Browse files
Publishing: add yq binary for Linux and Windows, use from publish script.
1 parent ee3b725 commit d06207d

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

tool/publish.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
. "$(dirname "$0")"/common.sh
22

33
# NOTE: This script requires version 3 of yq.
4-
# E.g. download from https://github.com/mikefarah/yq/releases/tag/3.4.1
5-
# and temporarily add to PATH for this script:
6-
# export PATH=$PATH:"/path/to/yq/"
4+
# Download versions for other architectures from https://github.com/mikefarah/yq/releases/tag/3.4.1
5+
msys=false
6+
case "$( uname )" in #(
7+
MSYS* | MINGW* ) msys=true ;; #(
8+
esac
9+
if [ $msys ]; then
10+
YQCMD="${root}/tool/yq_windows_amd64.exe"
11+
else
12+
YQCMD="${root}/tool/yq_linux_amd64"
13+
fi
14+
echo "Testing yq version..."
15+
$YQCMD -V
16+
echo "Testing yq version...DONE"
717

818
# ======================= BEFORE publishing==================== #
919

1020
echo "Removing dependency_overrides from all pubspec.yaml files (backup at pubspec.yaml.original)"
1121
find "${root}" -type f -name "pubspec.yaml" \
1222
-exec echo "Processing {}" \; \
1323
-exec cp "{}" "{}.original" \; \
14-
-exec yq delete -i "{}" dependency_overrides \;
24+
-exec "$YQCMD" delete -i "{}" dependency_overrides \;
1525

1626
# update links in the readme (see `git restore "${root}/objectbox/README.md"` below)
1727
"${root}/tool/pubdev-links.sh"
@@ -26,7 +36,7 @@ function publish() {
2636
pkg_dir="${root}/${1}"
2737
pubspec="${pkg_dir}/pubspec.yaml"
2838

29-
echo -e "You're about to publish directory \e[33m'${1}'\e[39m as package \e[33m$(yq read "${pubspec}" name) v$(yq read "${pubspec}" version)\e[39m"
39+
echo -e "You're about to publish directory \e[33m'${1}'\e[39m as package \e[33m$($YQCMD read "${pubspec}" name) v$($YQCMD read "${pubspec}" version)\e[39m"
3040
echo -e "\e[31mWARNING: The same version can NOT be published twice!\e[39m"
3141
read -p " Publish to pub.dev [y/N]? " yn
3242
case $yn in

tool/yq_linux_amd64

5.8 MB
Binary file not shown.

tool/yq_windows_amd64.exe

5.98 MB
Binary file not shown.

0 commit comments

Comments
 (0)