18
18
workflow_dispatch :
19
19
20
20
jobs :
21
- build :
21
+ setup :
22
22
runs-on : ubuntu-latest
23
+ outputs :
24
+ PACKAGE_VERSION : ${{ steps.builddata.outputs.PACKAGE_VERSION }}
25
+ MINOR_PACKAGE_VERSION : ${{ steps.builddata.outputs.MINOR_PACKAGE_VERSION }}
26
+ BUILD_DATE : ${{ steps.builddata.outputs.BUILD_DATE }}
27
+ steps :
28
+ - uses : actions/checkout@v3
29
+ - uses : actions/setup-node@v3
30
+ with :
31
+ node-version : ' 16.x'
32
+ - name : BuildData
33
+ id : builddata
34
+ run : |
35
+ set -ex -o pipefail
36
+ env | sort
37
+
38
+ # handle full version number
39
+ VERSION=$(jq '.version' docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/")
40
+ echo Current version in code is :${VERSION}:
41
+ echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_OUTPUT
42
+
43
+ # handle minor version
44
+ MINOR_VERSION=$(jq '.version' docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9])\.[0-9]?[0-9].*/\1/")
45
+ echo Current minor version in code is :${MINOR_VERSION}:
46
+ echo "MINOR_PACKAGE_VERSION=${MINOR_VERSION}" >> $GITHUB_OUTPUT
23
47
48
+ # get the current date for using in dev builds
49
+ BUILD_DATE=$(date '+%Y%m%d')
50
+ echo Build date is :${BUILD_DATE}
51
+ echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT
52
+
53
+ build :
54
+ runs-on : ubuntu-latest
24
55
strategy :
25
56
matrix :
26
57
node-version : [16.x]
41
72
npx cobertura-merge -o merged_coverage.xml shim=./libraries/fabric-shim/coverage/cobertura-coverage.xml contractapi=./apis/fabric-contract-api/coverage/cobertura-coverage.xml -p
42
73
- uses : actions/upload-artifact@v3
43
74
name : Upload test results
75
+ if : success() || failure()
44
76
with :
45
77
name : TestResults
46
78
path : ./**/test-results.xml
65
97
66
98
fvtest :
67
99
runs-on : ubuntu-latest
68
- needs : build
100
+ needs : [ build]
69
101
strategy :
70
102
matrix :
71
103
node-version : [16.x]
86
118
path : build/
87
119
88
120
- name : Setup the fv build
121
+ env :
122
+ PIPELINE_WORKSPACE : workspace
89
123
run : |
90
124
set -xev
91
125
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
@@ -106,17 +140,13 @@ jobs:
106
140
node common/scripts/install-run-rush.js test:fv --verbose
107
141
node common/scripts/install-run-rush.js test:e2e --verbose
108
142
109
- - name : upload results
110
- run : |
111
- set -xev
112
- mkdir -p testlogs
113
- find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} testlogs \;
114
143
115
144
- uses : actions/upload-artifact@v3
145
+ if : success() || failure()
116
146
name : TestLogs
117
147
with :
118
148
name : TestLogs
119
- path : testlogs\
149
+ path : ./**/*.build.log
120
150
121
151
122
152
# Job to handle the auditing of the code
@@ -148,16 +178,15 @@ jobs:
148
178
npm install --registry http://localhost:4873 fabric-shim fabric-shim-api fabric-contract-api --save
149
179
npm audit --audit-level=moderate
150
180
151
- publish :
181
+ publishnpm :
152
182
runs-on : ubuntu-latest
153
183
needs : [build,fvtest,src_audit]
154
184
if : startsWith(github.ref, 'refs/tags/')
155
185
steps :
156
186
- uses : actions/setup-node@v3
157
187
with :
158
188
node-version : ' 16.x'
159
- registry-url : ' https://npm.pkg.github.com'
160
- scope : ' @mbwhite'
189
+ registry-url : ' https://registry.npmjs.org'
161
190
- uses : actions/download-artifact@v3
162
191
with :
163
192
name : node-tgzs
@@ -168,5 +197,41 @@ jobs:
168
197
cd build
169
198
find . -type f -name 'fabric-*.tgz' -exec npm publish {} \;
170
199
env:
171
- NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172
-
200
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
201
+
202
+
203
+ publishdocker :
204
+ runs-on : ubuntu-latest
205
+ needs : [setup,build,fvtest,src_audit]
206
+ if : startsWith(github.ref, 'refs/tags/')
207
+ steps :
208
+ - uses : actions/setup-node@v3
209
+ with :
210
+ node-version : ' 16.x'
211
+ - uses : actions/download-artifact@v3
212
+ with :
213
+ name : nodeenv-docker-image
214
+ path : build/
215
+ - name : Push to registry
216
+ run : |
217
+ set -xev
218
+ wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
219
+ chmod +x ./manifest-tool
220
+
221
+ echo "Version strings are ${PACKAGE_VERSION} ${MINOR_PACKAGE_VERSION}"
222
+
223
+ docker image load --input build/fabric-javaenv.tar.gz
224
+ docker images
225
+ docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD}
226
+ echo "Logged in to docker registry"
227
+ # tag javaenv image to PACKAGE_VERSION
228
+ docker tag hyperledger/fabric-javaenv hyperledger/fabric-nodeenv:amd64-${ PACKAGE_VERSION }
229
+ # push javaenv to repository
230
+ docker push hyperledger/fabric-javaenv:amd64-${ PACKAGE_VERSION }
231
+ ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-${ PACKAGE_VERSION }" --target "hyperledger/fabric-nodeenv:${ PACKAGE_VERSION }"
232
+ ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-${ PACKAGE_VERSION }" --target "hyperledger/fabric-nodeenv:${ MINOR_PACKAGE_VERSION }"
233
+ env :
234
+ DOCKER_REGISTRY_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
235
+ DOCKER_REGISTRY_PASSWORD : ${{ secrets.DOCKERHUB_TOKEN }}
236
+ PACAKGE_VERSION : ${{ needs.setup.outputs.PACKAGE_VERSION }}
237
+ MINOR_PACKAGE_VERSION : ${{ needs.setup.outputs.MINOR_PACKAGE_VERSION }}
0 commit comments