-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpubpub.sh
executable file
·46 lines (40 loc) · 1.23 KB
/
pubpub.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -e && cd "${0%/*}"
# creates a copy of the project in temporary directory
# and prepares the copy to be published
temp_pub_dir=$(mktemp -d -t pub-XXXXXXX)
echo "$temp_pub_dir"
rsync -Rrv ./ "$temp_pub_dir" \
--exclude=".git/" \
--exclude="pubpub.sh" \
--exclude="test/" \
--exclude="todo.txt" \
--exclude="example/build" \
--exclude="example/android" \
--exclude="example/ios" \
--exclude="example/web" \
--exclude="example/lib/generated_plugin_registrant.dart" \
--exclude="example/example.iml" \
--exclude="benchmark/" \
--exclude="reference/" \
--exclude="shell/" \
--exclude="shell_nogit/" \
--exclude="build/" \
--exclude="README.md" \
--exclude=".github" \
--exclude="labuda/" \
--exclude="draft/" \
--exclude="experiments"
# removing everything before "\n# ", the first header
old_readme=$(cat README.md | tr '\n' '\r')
new_readme=$(echo "$old_readme" | perl -p0e 's|^.*?\r# |# \1|')
new_readme=$(echo "$new_readme" | tr '\r' '\n')
#№new_readme=$(echo $old_readme | perl -p0e 's|^.*?\r# |# \1|' | tr '\r' '\n')
echo "$new_readme" > "$temp_pub_dir/README.md"
cd "$temp_pub_dir"
mkdir .git
dartfmt -w .
flutter analyze
#flutter pub publish --dry-run
flutter pub publish
#open "$temp_pub_dir"