Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 97b1d14

Browse files
publish script: restore files also on failure
Also drop long unused code and printing some new lines for readability.
1 parent e315631 commit 97b1d14

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

‎tool/pubdev-links.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
. "$(dirname "0ドル")"/common.sh
33

4-
echo "Setting pub.dev specific links"
4+
echo "Modifying links for publishing to pub.dev (shouldn't be committed!)..."
55

66
update objectbox/README.md "s|CHANGELOG.md|https://pub.dev/packages/objectbox/changelog|g"
77
update objectbox/README.md "s|../CONTRIBUTING.md|https://github.com/objectbox/objectbox-dart/blob/main/CONTRIBUTING.md|g"

‎tool/publish.sh‎

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,19 @@ if [ "$msys" = true ]; then
1212
else
1313
YQCMD="${root}/tool/yq_linux_amd64"
1414
fi
15-
echo "Testing yq version..."
15+
echo ""
16+
echo "Testing yq..."
1617
$YQCMD -V
17-
echo "Testing yq version...DONE"
1818

19-
# ======================= BEFORE publishing==================== #
20-
21-
# Disabled to publish with Dart SDK 2.19, see objectbox/objectbox-dart#55.
22-
#echo "Removing dependency_overrides from all pubspec.yaml files (backup at pubspec.yaml.original)"
23-
#find "${root}" -type f -name "pubspec.yaml" \
24-
# -exec echo "Processing {}" \; \
25-
# -exec cp "{}" "{}.original" \; \
26-
# -exec "$YQCMD" delete -i "{}" dependency_overrides \;
19+
# ======================= BEFORE publishing ==================== #
2720

2821
# Update links in READMEs (restored by git restore commands below).
22+
echo ""
23+
echo "Updating links with /tool/pubdev-links.sh..."
2924
"${root}/tool/pubdev-links.sh"
3025

3126
# Verify MixPanel project token file exists. Obtain token from MixPanel project settings.
27+
echo ""
3228
echo "analysis: checking if generator/lib/assets/analysis-token.txt exists..."
3329
analysisTokenFile="${root}/generator/lib/assets/analysis-token.txt"
3430
if [ -f $analysisTokenFile ]; then
@@ -46,7 +42,23 @@ else
4642
esac
4743
fi
4844

45+
# ======================= AFTER publishing ==================== #
46+
47+
# Cleanup function that always runs (even on failure/interrupt)
48+
function cleanup() {
49+
echo ""
50+
echo "Reverting changes of /tool/pubdev-links.sh..."
51+
echo "Restoring objectbox/README.md"
52+
git restore "${root}/objectbox/README.md"
53+
echo "Restoring objectbox/example/README.md"
54+
git restore "${root}/objectbox/example/README.md"
55+
}
56+
57+
# Register cleanup function to run on exit (success, failure, or interrupt)
58+
trap cleanup EXIT
59+
4960
# =========================== PUBLISH ======================== #
61+
5062
function publish() {
5163
if [[ "$#" -ne "1" ]]; then
5264
echo "internal error - function usage: publish <package path>"
@@ -56,6 +68,7 @@ function publish() {
5668
pkg_dir="${root}/${1}"
5769
pubspec="${pkg_dir}/pubspec.yaml"
5870

71+
echo ""
5972
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"
6073
echo -e "\e[31mWARNING: The same version can NOT be published twice!\e[39m"
6174
read -p " Publish to pub.dev [y/N]? " yn
@@ -73,20 +86,8 @@ function publish() {
7386
publish objectbox
7487
publish generator
7588

89+
echo ""
7690
echo "⚠️ WAIT A MINUTE before publishing the Flutter packages, or resolving the objectbox package version will fail"
7791

7892
publish flutter_libs
7993
publish sync_flutter_libs
80-
81-
#======================== AFTER publishing==================== #
82-
83-
# Disabled to publish with Dart SDK 2.19, see objectbox/objectbox-dart#55.
84-
#echo "Restoring pubspec.yaml files from backup pubspec.yaml.original"
85-
#find "${root}" -type f -name "pubspec.yaml" \
86-
# -exec echo "Restoring {}" \; \
87-
# -exec mv "{}.original" "{}" \;
88-
89-
echo "Restoring objectbox/README.md"
90-
git restore "${root}/objectbox/README.md"
91-
echo "Restoring objectbox/example/README.md"
92-
git restore "${root}/objectbox/example/README.md"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /