@@ -98,21 +98,35 @@ jobs:
98
98
tag="beta"
99
99
fi
100
100
101
- if [[ "$tag" ]]; then
102
- yarn workspace @connext/nxtp-utils npm publish --access public --tag $tag
103
- yarn workspace @connext/smart-contracts npm publish --access public --tag $tag
104
- yarn workspace @connext/nxtp-txservice npm publish --access public --tag $tag
105
- yarn workspace @connext/nxtp-adapters-subgraph npm publish --access public --tag $tag
106
- yarn workspace @connext/nxtp-adapters-cache npm publish --access public --tag $tag
107
- yarn workspace @connext/sdk npm publish --access public --tag $tag
108
- else
109
- yarn workspace @connext/nxtp-utils npm publish --access public
110
- yarn workspace @connext/smart-contracts npm publish --access public
111
- yarn workspace @connext/nxtp-txservice npm publish --access public
112
- yarn workspace @connext/nxtp-adapters-subgraph npm publish --access public
113
- yarn workspace @connext/nxtp-adapters-cache npm publish --access public
114
- yarn workspace @connext/sdk npm publish --access public
115
- fi
101
+ workspaces=(
102
+ "packages/nxtp-utils:@connext/nxtp-utils"
103
+ "packages/smart-contracts:@connext/smart-contracts"
104
+ "packages/nxtp-txservice:@connext/nxtp-txservice"
105
+ "packages/nxtp-adapters-subgraph:@connext/nxtp-adapters-subgraph"
106
+ "packages/nxtp-adapters-cache:@connext/nxtp-adapters-cache"
107
+ "packages/agents/sdk:@connext/sdk"
108
+ )
109
+
110
+ for entry in "${workspaces[@]}"; do
111
+ IFS=":"; read -ra split_entry <<< "$entry"
112
+ directory="${split_entry[0]}"
113
+ workspace="${split_entry[1]}"
114
+ subpackage_version=$(cat $directory/package.json | jq -r '.version')
115
+
116
+ echo "Checking $workspace for existing version..."
117
+ published_version=$(npm view $workspace version)
118
+
119
+ if [[ "$published_version" != "$subpackage_version" ]]; then
120
+ echo "Publishing $workspace with version $subpackage_version"
121
+ if [[ "$tag" ]]; then
122
+ yarn workspace $workspace npm publish --access public --tag $tag
123
+ else
124
+ yarn workspace $workspace npm publish --access public
125
+ fi
126
+ else
127
+ echo "Skipping $workspace as version $subpackage_version already exists"
128
+ fi
129
+ done
116
130
117
131
- name : Extract version, determine tag, and publish contracts
118
132
if : ${{ startsWith(github.ref, 'refs/tags/contracts-v') }}
@@ -127,13 +141,31 @@ jobs:
127
141
tag="beta"
128
142
fi
129
143
130
- if [[ "$tag" ]]; then
131
- yarn workspace @connext/nxtp-utils npm publish --access public --tag $tag
132
- yarn workspace @connext/smart-contracts npm publish --access public --tag $tag
133
- else
134
- yarn workspace @connext/nxtp-utils npm publish --access public
135
- yarn workspace @connext/smart-contracts npm publish --access public
136
- fi
144
+ workspaces=(
145
+ "packages/nxtp-utils:@connext/nxtp-utils"
146
+ "packages/smart-contracts:@connext/smart-contracts"
147
+ )
148
+
149
+ for entry in "${workspaces[@]}"; do
150
+ IFS=":"; read -ra split_entry <<< "$entry"
151
+ directory="${split_entry[0]}"
152
+ workspace="${split_entry[1]}"
153
+ subpackage_version=$(cat $directory/package.json | jq -r '.version')
154
+
155
+ echo "Checking $workspace for existing version..."
156
+ published_version=$(npm view $workspace version)
157
+
158
+ if [[ "$published_version" != "$subpackage_version" ]]; then
159
+ echo "Publishing $workspace with version $subpackage_version"
160
+ if [[ "$tag" ]]; then
161
+ yarn workspace $workspace npm publish --access public --tag $tag
162
+ else
163
+ yarn workspace $workspace npm publish --access public
164
+ fi
165
+ else
166
+ echo "Skipping $workspace as version $subpackage_version already exists"
167
+ fi
168
+ done
137
169
138
170
build-and-push-router-publisher-image :
139
171
if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/testnet-prod' || github.ref == 'refs/heads/prod'
0 commit comments