60
60
else
61
61
npm run preinstall || { echo "Preinstall failed"; exit 1; }
62
62
export PATH="${XDG_CONFIG_HOME:-$HOME}/.foundry/bin:$PATH"
63
- if [ -f ~/.bashrc ]; then
64
- source ~/.bashrc
63
+ if [ -f "${HOME}/.bashrc" ]; then
64
+ # shellcheck source=/dev/null
65
+ source "${HOME}/.bashrc"
65
66
fi
66
67
foundryup
67
68
fi
90
91
- name : Run linting
91
92
continue-on-error : true
92
93
run : |
93
- yarn lint-code || echo "Linting completed with warnings"
94
- yarn lint:oapi || echo "OpenAPI linting completed with warnings"
95
- yarn lint:protobuf || echo "Protobuf linting completed with warnings"
94
+ {
95
+ yarn lint-code || echo "Linting completed with warnings"
96
+ yarn lint:oapi || echo "OpenAPI linting completed with warnings"
97
+ yarn lint:protobuf || echo "Protobuf linting completed with warnings"
98
+ }
96
99
97
100
run-satp-tests :
98
101
needs : build-satp-dev
@@ -136,7 +139,8 @@ jobs:
136
139
if : steps.cache.outputs.cache-hit != 'true'
137
140
run : |
138
141
curl -L https://foundry.paradigm.xyz | bash
139
- source $HOME/.bashrc && foundryup
142
+ # shellcheck source=/dev/null
143
+ source "${HOME}/.bashrc" && foundryup
140
144
141
145
- name : Install dependencies
142
146
if : steps.cache.outputs.cache-hit != 'true'
@@ -153,7 +157,7 @@ jobs:
153
157
154
158
# Set Docker tags based on branch and commit information
155
159
set-docker-tags :
156
- needs : run-satp-tests
160
+ needs : run-satp-tests
157
161
if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/satp-dev')
158
162
runs-on : ubuntu-22.04
159
163
outputs :
@@ -163,18 +167,6 @@ jobs:
163
167
ghcr_image : ${{ steps.set_tags.outputs.ghcr_image }}
164
168
steps :
165
169
- uses : actions/checkout@v4.1.7
166
- - name : Debug Build Info
167
- run : |
168
- PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
169
- echo "Debug: Current ref = ${{ github.ref }}"
170
- echo "Debug: Event name = ${{ github.event_name }}"
171
- echo "Debug: GitHub workspace = ${{ github.workspace }}"
172
- echo "Debug: Repository = ${{ github.repository }}"
173
- echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
174
- echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
175
- echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
176
- echo "Debug: Package version = ${PACKAGE_VERSION}"
177
- echo "Debug: Commit hash = $(git rev-parse --short HEAD)"
178
170
- name : Set image tags
179
171
id : set_tags
180
172
run : |
@@ -183,16 +175,28 @@ jobs:
183
175
DOCKERHUB_IMAGE="hyperledger/satp-hermes-gateway"
184
176
GHCR_IMAGE="ghcr.io/hyperledger-cacti/satp-hermes-gateway"
185
177
186
- echo "Debug: Setting tag suffix = ${TAG_SUFFIX}"
187
- echo "Debug: Setting tag version = ${TAG_VERSION}"
188
- echo "Debug: Setting dockerhub image = ${DOCKERHUB_IMAGE}"
189
- echo "Debug: Setting ghcr image = ${GHCR_IMAGE}"
190
-
191
- echo "tag_suffix=${TAG_SUFFIX}" >> $GITHUB_OUTPUT
192
- echo "tag_version=${TAG_VERSION}" >> $GITHUB_OUTPUT
193
- echo "dockerhub_image=${DOCKERHUB_IMAGE}" >> $GITHUB_OUTPUT
194
- echo "ghcr_image=${GHCR_IMAGE}" >> $GITHUB_OUTPUT
195
-
178
+ {
179
+ echo "tag_suffix=${TAG_SUFFIX}"
180
+ echo "tag_version=${TAG_VERSION}"
181
+ echo "dockerhub_image=${DOCKERHUB_IMAGE}"
182
+ echo "ghcr_image=${GHCR_IMAGE}"
183
+ } >> "$GITHUB_OUTPUT"
184
+
185
+ - name : Debug Build Info
186
+ run : |
187
+ PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
188
+ {
189
+ echo "Debug: Current ref = ${{ github.ref }}"
190
+ echo "Debug: Event name = ${{ github.event_name }}"
191
+ echo "Debug: GitHub workspace = ${{ github.workspace }}"
192
+ echo "Debug: Repository = ${{ github.repository }}"
193
+ echo "Debug: Building for tag version = ${{ steps.set_tags.outputs.tag_version }}"
194
+ echo "Debug: Building for dockerhub image = ${{ steps.set_tags.outputs.dockerhub_image }}"
195
+ echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
196
+ echo "Debug: Package version = ${PACKAGE_VERSION}"
197
+ echo "Debug: Commit hash = $(git rev-parse --short HEAD)"
198
+ }
199
+
196
200
# Build and push Docker image to Docker Hub
197
201
build-and-push-dockerhub :
198
202
needs : set-docker-tags
@@ -204,13 +208,15 @@ jobs:
204
208
- uses : actions/checkout@v4.1.7
205
209
- name : Debug Build Info
206
210
run : |
207
- echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
208
- echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
209
- echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
210
- echo "Debug: Working directory content:"
211
- ls -la
212
- echo "Debug: SATP plugin directory content:"
213
- ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
211
+ {
212
+ echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
213
+ echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
214
+ echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
215
+ echo "Debug: Working directory content:"
216
+ ls -la
217
+ echo "Debug: SATP plugin directory content:"
218
+ ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
219
+ }
214
220
215
221
- name : Use Node.js ${{ env.NODEJS_VERSION }}
216
222
uses : actions/setup-node@v4.0.3
@@ -219,21 +225,25 @@ jobs:
219
225
220
226
- name : Configure and build bundle
221
227
run : |
222
- echo "Debug: Starting bundle configuration and build"
223
- yarn configure
224
- echo "Debug: Yarn configure completed"
225
- yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
226
- echo "Debug: Bundle build completed"
228
+ {
229
+ echo "Debug: Starting bundle configuration and build"
230
+ yarn configure
231
+ echo "Debug: Yarn configure completed"
232
+ yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
233
+ echo "Debug: Bundle build completed"
234
+ }
227
235
228
236
- name : Set up Docker Build
229
237
uses : docker/setup-buildx-action@v3
230
238
231
239
- name : Debug Docker Info
232
240
run : |
233
- echo "Debug: Docker version:"
234
- docker version
235
- echo "Debug: Docker info:"
236
- docker info
241
+ {
242
+ echo "Debug: Docker version:"
243
+ docker version
244
+ echo "Debug: Docker info:"
245
+ docker info
246
+ }
237
247
238
248
- name : Login to Docker Hub
239
249
uses : docker/login-action@v3
@@ -260,9 +270,9 @@ jobs:
260
270
261
271
- name : Tag and push latest to Docker Hub
262
272
run : |
263
- docker pull ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}
264
- docker tag ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }} ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest
265
- docker push ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest
273
+ docker pull " ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}"
274
+ docker tag " ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}" " ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest"
275
+ docker push " ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest"
266
276
267
277
# Build and push Docker image to GitHub Container Registry
268
278
build-and-push-ghcr :
@@ -275,13 +285,15 @@ jobs:
275
285
- uses : actions/checkout@v4.1.7
276
286
- name : Debug Build Info
277
287
run : |
278
- echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
279
- echo "Debug: Building for GHCR image = ${{ needs.set-docker-tags.outputs.ghcr_image }}"
280
- echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
281
- echo "Debug: Working directory content:"
282
- ls -la
283
- echo "Debug: SATP plugin directory content:"
284
- ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
288
+ {
289
+ echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
290
+ echo "Debug: Building for GHCR image = ${{ needs.set-docker-tags.outputs.ghcr_image }}"
291
+ echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
292
+ echo "Debug: Working directory content:"
293
+ ls -la
294
+ echo "Debug: SATP plugin directory content:"
295
+ ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
296
+ }
285
297
286
298
- name : Use Node.js ${{ env.NODEJS_VERSION }}
287
299
uses : actions/setup-node@v4.0.3
@@ -290,21 +302,25 @@ jobs:
290
302
291
303
- name : Configure and build bundle
292
304
run : |
293
- echo "Debug: Starting bundle configuration and build"
294
- yarn configure
295
- echo "Debug: Yarn configure completed"
296
- yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
297
- echo "Debug: Bundle build completed"
305
+ {
306
+ echo "Debug: Starting bundle configuration and build"
307
+ yarn configure
308
+ echo "Debug: Yarn configure completed"
309
+ yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
310
+ echo "Debug: Bundle build completed"
311
+ }
298
312
299
313
- name : Set up Docker Build
300
314
uses : docker/setup-buildx-action@v3
301
315
302
316
- name : Debug Docker Info
303
317
run : |
304
- echo "Debug: Docker version:"
305
- docker version
306
- echo "Debug: Docker info:"
307
- docker info
318
+ {
319
+ echo "Debug: Docker version:"
320
+ docker version
321
+ echo "Debug: Docker info:"
322
+ docker info
323
+ }
308
324
309
325
- name : Login to GHCR
310
326
uses : docker/login-action@v3
@@ -332,6 +348,6 @@ jobs:
332
348
333
349
- name : Tag and push latest to GHCR
334
350
run : |
335
- docker pull ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}
336
- docker tag ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }} ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest
337
- docker push ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest
351
+ docker pull " ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}"
352
+ docker tag " ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}" " ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"
353
+ docker push " ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"
0 commit comments