-
Notifications
You must be signed in to change notification settings - Fork 1
182 lines (171 loc) · 8.08 KB
/
npm_publish_light.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
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Creates and publishes @kindredgroup/cohort_sdk_js, @kindredgroup/cohort_sdk_client
# NPM packages. The "cohort_sdk_js" is bundled together with Talos sources so that users
# could build it locally.
# Performs a basic build test by installing "cohort_sdk_client" into
# "cohort_banking_initiator_js", "cohort_banking_replicator_js" apps and then builds apps.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
name: Build and Publish Cohort SDK NPMs
on:
# workflow_call:
push:
env:
SDK_JS_PACKAGE_NAME: "@kindredgroup/cohort_sdk_js"
SDK_CLIENT_PACKAGE_NAME: "@kindredgroup/cohort_sdk_client"
REGISTRY: "https://npm.pkg.github.com"
jobs:
npm:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
dirSdkJs: packages/cohort_sdk_js
dirSdkJsClient: cohort_sdk_client
dirCohortInitiator: cohort_banking_initiator_js
dirCohortReplicator: cohort_banking_replicator_js
name: Publish SDK NPS with bundled Rust for node@16
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
registry-url: "https://npm.pkg.github.com"
- name: Customise host image
shell: bash
run: |-
echo "NPM_CONFIG_USERCONFIG=$NPM_CONFIG_USERCONFIG"
cat $NPM_CONFIG_USERCONFIG
echo ""
- name: Setup version for ${{ matrix.settings.dirSdkJs }} NPM
id: sdk-js-version
shell: bash
run: |-
echo "Building SDK JS Library"
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
npm ci --foreground-scripts
../../scripts/github-actions-ci/set-npm-dev-version.sh ${{ env.SDK_JS_PACKAGE_NAME }} "SDK_JS_PACKAGE_VERSION"
echo ""
- name: Build and Publish ${{ matrix.settings.dirSdkJs }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
echo "Current version is"
npm version
npm publish --foreground-scripts
echo ""
- name: Setup version for ${{ matrix.settings.dirSdkJsClient }} NPM
id: sdk-client-version
shell: bash
env:
SDK_JS_PACKAGE_VERSION: ${{ steps.sdk-js-version.outputs.SDK_JS_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
echo "Building SDK Client"
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -lah
rm package-lock.json || true
echo "D: npm install $SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION --foreground-scripts"
npm install "$SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION" --foreground-scripts
../scripts/github-actions-ci/set-npm-dev-version.sh ${{ env.SDK_CLIENT_PACKAGE_NAME }} "SDK_CLIENT_PACKAGE_VERSION"
echo ""
- name: Build and Publish ${{ matrix.settings.dirSdkJsClient }} NPM
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -l
echo "Current version is"
npm version
npm ci --foreground-scripts
npm run build --foreground-scripts
npm publish --foreground-scripts
echo ""
- name: Build ${{ matrix.settings.dirCohortInitiator }}
env:
SDK_CLIENT_PACKAGE_VERSION: ${{ steps.sdk-client-version.outputs.SDK_CLIENT_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_NAPI_RS_STEP: true # this will re-use already bundled native lib
shell: bash
run: |-
cd ${{ matrix.settings.dirCohortInitiator }}
pwd
ls -l
rm package-lock.json || true
echo "D: npm install $SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION --foreground-scripts"
#npm install "$SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION" --foreground-scripts
npm run build --foreground-scripts
- name: Unublish SDK NPMs on failure
if: ${{ failure() }}
shell: bash
env:
SDK_JS_PACKAGE_VERSION: ${{ steps.sdk-js-version.outputs.SDK_JS_PACKAGE_VERSION }}
SDK_CLIENT_PACKAGE_VERSION: ${{ steps.sdk-client-version.outputs.SDK_CLIENT_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -l
echo "Current version is"
npm version
echo "Unpublishing faulty version"
echo "D: npm unpublish $SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION"
npm unpublish "$SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION" --registry $REGISTRY
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
echo "Current version is"
npm version
echo "Unpublishing faulty version"
echo "D: npm unpublish $SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION"
npm unpublish "$SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION" --registry $REGISTRY
- name: Build ${{ matrix.settings.dirCohortReplicator }}
env:
SDK_CLIENT_PACKAGE_VERSION: ${{ steps.sdk-client-version.outputs.SDK_CLIENT_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_NAPI_RS_STEP: true # this will re-use already bundled native lib
shell: bash
run: |-
cd ${{ matrix.settings.dirCohortInitiator }}
pwd
ls -l
rm package-lock.json || true
echo "D: npm install $SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION --foreground-scripts"
npm install "$SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION" --foreground-scripts
npm run build --foreground-scripts
- name: Unublish SDK NPMs on failure
if: ${{ failure() }}
shell: bash
env:
SDK_JS_PACKAGE_VERSION: ${{ steps.sdk-js-version.outputs.SDK_JS_PACKAGE_VERSION }}
SDK_CLIENT_PACKAGE_VERSION: ${{ steps.sdk-client-version.outputs.SDK_CLIENT_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -l
echo "Current version is"
npm version
echo "Unpublishing faulty version"
echo "D: npm unpublish $SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION"
npm unpublish "$SDK_CLIENT_PACKAGE_NAME@$SDK_CLIENT_PACKAGE_VERSION" --registry $REGISTRY
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
echo "Current version is"
npm version
echo "Unpublishing faulty version"
echo "D: npm unpublish $SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION"
npm unpublish "$SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION" --registry $REGISTRY