Skip to content

Commit 95c25d8

Browse files
authored
Merge pull request #83 from polywrap/dev
prep 0.1.0a13 | /workflows/release-pr
2 parents 1e84d21 + 2f58122 commit 95c25d8

File tree

2 files changed

+36
-28
lines changed

2 files changed

+36
-28
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0a12
1+
0.1.0a13

scripts/publishPackages.sh

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
# joinByString is a utility function to join an array of strings with a separator string
2+
function joinByString() {
3+
local separator="$1"
4+
shift
5+
local first="$1"
6+
shift
7+
printf "%s" "$first" "${@/#/$separator}"
8+
}
9+
10+
# isPackagePublished is a utility function to check if a package is published
11+
# This will only work for the latest version of the package
12+
# Can only be called inside the top level function since directory needs to be changed
13+
function isPackagePublished() {
14+
local package=$1
15+
local version=$2
16+
17+
poetry search $package | grep "$package ($version)"
18+
local exit_code=$?
19+
20+
if [ "$exit_code" -eq "0" ]; then
21+
return 0
22+
else
23+
return 1
24+
fi
25+
}
26+
127
function patchVersion() {
228
local package=$1
329
local version=$2
@@ -24,15 +50,14 @@ function patchVersion() {
2450

2551
if [ "${#deps[@]}" -ne "0" ]; then # -ne is integer inequality
2652
if [ "${deps[0]}" != "" ]; then # != is string inequality
27-
for dep in "${deps[@]}"; do
28-
poetry add $dep@$version
29-
local addDepResult=$?
30-
if [ "$addDepResult" -ne "0" ]; then
31-
echo "Failed to add $dep@$version to $package"
32-
cd $pwd
33-
return 1
34-
fi
35-
done
53+
patchedDeps="$(joinByString "@$version " "${deps[@]}")@$version"
54+
poetry add $patchedDeps
55+
local addDepsResult=$?
56+
if [ "$addDepsResult" -ne "0" ]; then
57+
echo "Failed to add $patchedDeps to $package"
58+
cd $pwd
59+
return 1
60+
fi
3661
fi
3762
fi
3863

@@ -44,7 +69,7 @@ function patchVersion() {
4469
return 1
4570
fi
4671

47-
poetry install
72+
poetry install --no-root
4873
local installResult=$?
4974
if [ "$installResult" -ne "0" ]; then
5075
echo "Failed to install $package"
@@ -84,22 +109,6 @@ function publishPackage() {
84109
cd $pwd
85110
}
86111

87-
# This will only work for the latest version of the package
88-
# Can only be called inside the top level function since directory needs to be changed
89-
function isPackagePublished() {
90-
local package=$1
91-
local version=$2
92-
93-
poetry search $package | grep "$package ($version)"
94-
local exit_code=$?
95-
96-
if [ "$exit_code" -eq "0" ]; then
97-
return 0
98-
else
99-
return 1
100-
fi
101-
}
102-
103112
function waitForPackagePublish() {
104113
local package=$1
105114
local version=$2
@@ -131,7 +140,6 @@ function waitForPackagePublish() {
131140
fi
132141
}
133142

134-
135143
# Patching Verion of polywrap-msgpack
136144
echo "Patching Version of polywrap-msgpack to $1"
137145
patchVersion polywrap-msgpack $1

0 commit comments

Comments
 (0)