-
Notifications
You must be signed in to change notification settings - Fork 45
221 lines (187 loc) · 7.78 KB
/
deploy_node-pkgs.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: CC-BY-4.0
name: Deploy Node JS Packages
on:
push:
branches:
- main
paths:
- 'common/protos-js/package.json'
- 'sdks/fabric/interoperation-node-sdk/package.json'
- 'sdks/besu/interoperation-node-sdk/package.json'
- 'core/drivers/fabric-driver/VERSION'
- 'core/identity-management/iin-agent/VERSION'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
publish-protos:
if: github.repository_owner == 'hyperledger-labs'
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Use Protoc 3.15
run: |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip
unzip protoc-3.15.6-linux-x86_64.zip -d protoc
- name: Generate .npmrc
run: |
cp .npmrc.template .npmrc
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc
cat .npmrc
working-directory: common/protos-js
- name: Build
run: |
export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin"
make build
working-directory: common/protos-js
- name: Check if package already exists
run : |
PKG_NAME=$(node -p "require('./package.json').name")
PUBLISHED_VERSION=$(npm view $PKG_NAME version)
LOCAL_VERSION=$(node -p "require('./package.json').version")
if [[ "$PUBLISHED_VERSION" == "$LOCAL_VERSION" ]]; then
echo "PROTOS_JS_PUBLISH=false" >> $GITHUB_ENV
else
echo "PROTOS_JS_PUBLISH=true" >> $GITHUB_ENV
fi
working-directory: common/protos-js
- name: Publish
if: ${{ env.PROTOS_JS_PUBLISH == 'true' }}
run: make publish
working-directory: common/protos-js
publish-fabric-sdk:
if: ${{ always() && github.repository_owner == 'hyperledger-labs' }}
needs: [publish-protos]
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Generate .npmrc
run: |
cp .npmrc.template .npmrc
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc
cat .npmrc
working-directory: sdks/fabric/interoperation-node-sdk
- name: Build
run: make build
working-directory: sdks/fabric/interoperation-node-sdk
- name: Check if package already exists
run : |
PKG_NAME=$(node -p "require('./package.json').name")
PUBLISHED_VERSION=$(npm view $PKG_NAME version)
LOCAL_VERSION=$(node -p "require('./package.json').version")
if [[ "$PUBLISHED_VERSION" == "$LOCAL_VERSION" ]]; then
echo "WEAVER_FABRIC_SDK_PUBLISH=false" >> $GITHUB_ENV
else
echo "WEAVER_FABRIC_SDK_PUBLISH=true" >> $GITHUB_ENV
fi
working-directory: sdks/fabric/interoperation-node-sdk
- name: Publish
if: ${{ env.WEAVER_FABRIC_SDK_PUBLISH == 'true' }}
run: make publish
working-directory: sdks/fabric/interoperation-node-sdk
publish-besu-sdk:
if: ${{ always() && github.repository_owner == 'hyperledger-labs' }}
needs: [publish-protos]
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Generate .npmrc
run: |
cp .npmrc.template .npmrc
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc
cat .npmrc
working-directory: sdks/besu/interoperation-node-sdk
- name: Build
run: make build
working-directory: sdks/besu/interoperation-node-sdk
- name: Check if package already exists
run : |
PKG_NAME=$(node -p "require('./package.json').name")
PUBLISHED_VERSION=$(npm view $PKG_NAME version)
LOCAL_VERSION=$(node -p "require('./package.json').version")
if [[ "$PUBLISHED_VERSION" == "$LOCAL_VERSION" ]]; then
echo "WEAVER_BESU_SDK_PUBLISH=false" >> $GITHUB_ENV
else
echo "WEAVER_BESU_SDK_PUBLISH=true" >> $GITHUB_ENV
fi
working-directory: sdks/besu/interoperation-node-sdk
- name: Publish
if: ${{ env.WEAVER_BESU_SDK_PUBLISH == 'true' }}
run: make publish
working-directory: sdks/besu/interoperation-node-sdk
publish-driver-image:
if: ${{ always() && github.repository_owner == 'hyperledger-labs' }}
needs: [publish-protos, publish-fabric-sdk]
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate .npmrc
run: |
cp .npmrc.template .npmrc
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc
cat .npmrc
working-directory: core/drivers/fabric-driver
- name: Check if package already exists
run: (make check-if-tag-exists && echo "FABRIC_DRIVER_PUSH=true" >> $GITHUB_ENV) || echo "FABRIC_DRIVER_PUSH=false" >> $GITHUB_ENV
working-directory: core/drivers/fabric-driver
- name: Build and Push
if: ${{ env.FABRIC_DRIVER_PUSH == 'true' }}
run: make push-image
working-directory: core/drivers/fabric-driver
- name: Push latest tag
if: ${{ env.FABRIC_DRIVER_PUSH == 'true' }}
run: make push-image-latest
working-directory: core/drivers/fabric-driver
publish-iin-agent-image:
if: ${{ always() && github.repository_owner == 'hyperledger-labs' }}
needs: [publish-protos, publish-fabric-sdk]
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate .npmrc
run: |
cp .npmrc.template .npmrc
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc
cat .npmrc
working-directory: core/identity-management/iin-agent
- name: Check if package already exists
run: (make check-if-tag-exists && echo "IINAGENT_PUSH=true" >> $GITHUB_ENV) || echo "IINAGENT_PUSH=false" >> $GITHUB_ENV
working-directory: core/identity-management/iin-agent
- name: Build and Push
if: ${{ env.IINAGENT_PUSH == 'true' }}
run: make push-image
working-directory: core/identity-management/iin-agent
- name: Push latest tag
if: ${{ env.IINAGENT_PUSH == 'true' }}
run: make push-image-latest
working-directory: core/identity-management/iin-agent