@coherentglobal/wasm-runner 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-publish.yml +132 -0
- package/circleci/config.yml +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
name: Build and Publish Action
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- devops/pipeline
|
|
7
|
+
- dev
|
|
8
|
+
- master
|
|
9
|
+
- v*.*.*
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish-js-bundles:
|
|
13
|
+
name: Publish JS bundle-js
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: Get yarn cache directory path
|
|
20
|
+
id: yarn-cache-dir-path
|
|
21
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
22
|
+
|
|
23
|
+
- name: Restore yarn cache
|
|
24
|
+
id: yarn-cache
|
|
25
|
+
uses: actions/cache@v3
|
|
26
|
+
with:
|
|
27
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
28
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
29
|
+
restore-keys: |
|
|
30
|
+
${{ runner.os }}-yarn-
|
|
31
|
+
|
|
32
|
+
- name: Create Javascript Bundle
|
|
33
|
+
run: |
|
|
34
|
+
yarn install --frozen-lockfile
|
|
35
|
+
mkdir lib
|
|
36
|
+
yarn bundle
|
|
37
|
+
|
|
38
|
+
- name: Configure AWS Credentials
|
|
39
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
40
|
+
with:
|
|
41
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
42
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
43
|
+
aws-region: ${{ secrets.AWS_REGION }}
|
|
44
|
+
|
|
45
|
+
- name: Uploading JS Bundle to S3...
|
|
46
|
+
env:
|
|
47
|
+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
48
|
+
run: |
|
|
49
|
+
aws s3 sync ./lib $S3_BUCKET
|
|
50
|
+
|
|
51
|
+
build-publish:
|
|
52
|
+
needs: publish-js-bundles
|
|
53
|
+
name: Build & Publish [CodeArtifact]
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- name: Checkout
|
|
57
|
+
uses: actions/checkout@v3
|
|
58
|
+
|
|
59
|
+
- name: Get yarn cache directory path
|
|
60
|
+
id: yarn-cache-dir-path
|
|
61
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
62
|
+
|
|
63
|
+
- name: Restore yarn cache
|
|
64
|
+
id: yarn-cache
|
|
65
|
+
uses: actions/cache@v3
|
|
66
|
+
with:
|
|
67
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
68
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
69
|
+
restore-keys: |
|
|
70
|
+
${{ runner.os }}-yarn-
|
|
71
|
+
|
|
72
|
+
- name: Configure AWS Credentials
|
|
73
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
74
|
+
with:
|
|
75
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
76
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
77
|
+
aws-region: ${{ secrets.AWS_REGION }}
|
|
78
|
+
|
|
79
|
+
- name: get-authorization-token
|
|
80
|
+
env:
|
|
81
|
+
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
|
|
82
|
+
run: |
|
|
83
|
+
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain coherent-global --domain-owner $AWS_ACCOUNT --query authorizationToken --output text`
|
|
84
|
+
cat <<EOF >> .npmrc
|
|
85
|
+
registry=https://registry.npmjs.org
|
|
86
|
+
@coherentglobal:registry=https://coherent-global-$AWS_ACCOUNT.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/
|
|
87
|
+
//coherent-global-$AWS_ACCOUNT.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/:always-auth=true
|
|
88
|
+
//coherent-global-$AWS_ACCOUNT.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/:_authToken=${CODEARTIFACT_AUTH_TOKEN}
|
|
89
|
+
EOF
|
|
90
|
+
|
|
91
|
+
- name: Install dependencies and build 🔧
|
|
92
|
+
run: yarn install && yarn run build
|
|
93
|
+
|
|
94
|
+
- name: Publish
|
|
95
|
+
run: yarn publish --non-interactive
|
|
96
|
+
|
|
97
|
+
build-publish-public:
|
|
98
|
+
needs: publish-js-bundles
|
|
99
|
+
name: Build & Publish [NPM]
|
|
100
|
+
environment: PUBLIC
|
|
101
|
+
runs-on: ubuntu-latest
|
|
102
|
+
steps:
|
|
103
|
+
- name: Checkout
|
|
104
|
+
uses: actions/checkout@v3
|
|
105
|
+
|
|
106
|
+
- name: Get yarn cache directory path
|
|
107
|
+
id: yarn-cache-dir-path
|
|
108
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
109
|
+
|
|
110
|
+
- name: Restore yarn cache
|
|
111
|
+
id: yarn-cache
|
|
112
|
+
uses: actions/cache@v3
|
|
113
|
+
with:
|
|
114
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
115
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
116
|
+
restore-keys: |
|
|
117
|
+
${{ runner.os }}-yarn-
|
|
118
|
+
|
|
119
|
+
- name: Setup Node
|
|
120
|
+
uses: actions/setup-node@v3
|
|
121
|
+
with:
|
|
122
|
+
node-version: 16
|
|
123
|
+
registry-url: 'https://registry.npmjs.org'
|
|
124
|
+
always-auth: true
|
|
125
|
+
|
|
126
|
+
- name: Install dependencies and build 🔧
|
|
127
|
+
run: yarn install && yarn run build
|
|
128
|
+
|
|
129
|
+
- name: Publish package on NPM 📦
|
|
130
|
+
run: npm publish --access public
|
|
131
|
+
env:
|
|
132
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
aliases:
|
|
4
|
+
- &working-dir /tmp/project
|
|
5
|
+
|
|
6
|
+
commands:
|
|
7
|
+
persist-working-dir:
|
|
8
|
+
steps:
|
|
9
|
+
- persist_to_workspace:
|
|
10
|
+
root: *working-dir
|
|
11
|
+
paths:
|
|
12
|
+
- .
|
|
13
|
+
|
|
14
|
+
save-repo-cache:
|
|
15
|
+
steps:
|
|
16
|
+
- save_cache:
|
|
17
|
+
name: Save Repo Cache
|
|
18
|
+
key: source-v1-{{ .Branch }}-{{ .Revision }}
|
|
19
|
+
paths:
|
|
20
|
+
- .
|
|
21
|
+
|
|
22
|
+
save-yarn-package-cache:
|
|
23
|
+
steps:
|
|
24
|
+
- save_cache:
|
|
25
|
+
key: yarn-packages-v1-{{ checksum "yarn.lock" }}
|
|
26
|
+
paths:
|
|
27
|
+
- node_modules
|
|
28
|
+
|
|
29
|
+
restore-repo-cache:
|
|
30
|
+
steps:
|
|
31
|
+
- restore_cache:
|
|
32
|
+
name: Restore Repo Cache
|
|
33
|
+
keys:
|
|
34
|
+
- source-v1-{{ .Branch }}-{{ .Revision }}
|
|
35
|
+
- source-v1-{{ .Branch }}-
|
|
36
|
+
- source-v1-
|
|
37
|
+
|
|
38
|
+
restore-yarn-cache:
|
|
39
|
+
steps:
|
|
40
|
+
- restore_cache:
|
|
41
|
+
name: Restore Yarn Package Cache
|
|
42
|
+
keys:
|
|
43
|
+
- yarn-packages-v1-{{ checksum "yarn.lock" }}
|
|
44
|
+
|
|
45
|
+
aws-token-init:
|
|
46
|
+
steps:
|
|
47
|
+
- aws-cli/setup:
|
|
48
|
+
profile-name: awscircleci
|
|
49
|
+
- run:
|
|
50
|
+
name: Setup AWS Token
|
|
51
|
+
command: |
|
|
52
|
+
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain coherent-global --domain-owner ${AWS_MNL_ACCOUNT} --query authorizationToken --output text`
|
|
53
|
+
cat \<<EOF >> .npmrc
|
|
54
|
+
registry=https://coherent-global-${AWS_MNL_ACCOUNT}.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/
|
|
55
|
+
//coherent-global-${AWS_MNL_ACCOUNT}.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/:always-auth=true
|
|
56
|
+
//coherent-global-${AWS_MNL_ACCOUNT}.d.codeartifact.ap-southeast-1.amazonaws.com/npm/coherent-global/:_authToken=${CODEARTIFACT_AUTH_TOKEN}
|
|
57
|
+
EOF
|
|
58
|
+
|
|
59
|
+
install-dependencies:
|
|
60
|
+
steps:
|
|
61
|
+
- run:
|
|
62
|
+
name: Install Dependencies
|
|
63
|
+
command: |
|
|
64
|
+
yarn install --frozen-lockfile
|
|
65
|
+
|
|
66
|
+
build:
|
|
67
|
+
steps:
|
|
68
|
+
- run:
|
|
69
|
+
name: Build
|
|
70
|
+
command: |
|
|
71
|
+
yarn build
|
|
72
|
+
|
|
73
|
+
publish:
|
|
74
|
+
steps:
|
|
75
|
+
- run:
|
|
76
|
+
name: Publish Package
|
|
77
|
+
command: |
|
|
78
|
+
yarn publish --non-interactive
|
|
79
|
+
|
|
80
|
+
npm-config-set:
|
|
81
|
+
steps:
|
|
82
|
+
- run:
|
|
83
|
+
name: Setup NPM config
|
|
84
|
+
command: |
|
|
85
|
+
npm config set scope coherentglobal
|
|
86
|
+
echo "//registry.npmjs.org/:_authToken=${npm_TOKEN}" > .npmrc
|
|
87
|
+
|
|
88
|
+
publish_npm:
|
|
89
|
+
steps:
|
|
90
|
+
- run:
|
|
91
|
+
name: Publish Package to NPM
|
|
92
|
+
command: |
|
|
93
|
+
npm publish --access=public
|
|
94
|
+
|
|
95
|
+
bundle-js:
|
|
96
|
+
steps:
|
|
97
|
+
- run:
|
|
98
|
+
name: Create lib Folder
|
|
99
|
+
command: |
|
|
100
|
+
mkdir lib
|
|
101
|
+
- run:
|
|
102
|
+
name: Create Javascript Bundle
|
|
103
|
+
command: |
|
|
104
|
+
yarn bundle
|
|
105
|
+
|
|
106
|
+
executors:
|
|
107
|
+
node-lts:
|
|
108
|
+
docker:
|
|
109
|
+
- image: cimg/node:lts
|
|
110
|
+
working_directory: *working-dir
|
|
111
|
+
|
|
112
|
+
orbs:
|
|
113
|
+
aws-cli: circleci/aws-cli@2.0.0
|
|
114
|
+
aws-s3: circleci/aws-s3@3.0.0
|
|
115
|
+
|
|
116
|
+
workflows:
|
|
117
|
+
pipeline:
|
|
118
|
+
jobs:
|
|
119
|
+
- init:
|
|
120
|
+
context: AWS_ECR_MNL
|
|
121
|
+
filters:
|
|
122
|
+
branches:
|
|
123
|
+
only:
|
|
124
|
+
- devops
|
|
125
|
+
- dev
|
|
126
|
+
- master
|
|
127
|
+
- push-js-bundles:
|
|
128
|
+
requires:
|
|
129
|
+
- init
|
|
130
|
+
filters:
|
|
131
|
+
branches:
|
|
132
|
+
only:
|
|
133
|
+
- dev
|
|
134
|
+
- master
|
|
135
|
+
context:
|
|
136
|
+
- AWS_ECR_MNL
|
|
137
|
+
|
|
138
|
+
- build-and-publish:
|
|
139
|
+
context: AWS_ECR_MNL
|
|
140
|
+
requires:
|
|
141
|
+
- init
|
|
142
|
+
filters:
|
|
143
|
+
branches:
|
|
144
|
+
only:
|
|
145
|
+
- dev
|
|
146
|
+
- master
|
|
147
|
+
|
|
148
|
+
- build-and-publish-npm:
|
|
149
|
+
context: AWS_ECR_MNL
|
|
150
|
+
requires:
|
|
151
|
+
- init
|
|
152
|
+
filters:
|
|
153
|
+
branches:
|
|
154
|
+
only:
|
|
155
|
+
- master
|
|
156
|
+
|
|
157
|
+
jobs:
|
|
158
|
+
init:
|
|
159
|
+
executor: aws-cli/default
|
|
160
|
+
working_directory: *working-dir
|
|
161
|
+
steps:
|
|
162
|
+
- checkout
|
|
163
|
+
- aws-token-init
|
|
164
|
+
- persist-working-dir
|
|
165
|
+
|
|
166
|
+
push-js-bundles:
|
|
167
|
+
executor: node-lts
|
|
168
|
+
steps:
|
|
169
|
+
- attach_workspace:
|
|
170
|
+
at: *working-dir
|
|
171
|
+
- restore-yarn-cache
|
|
172
|
+
- install-dependencies
|
|
173
|
+
- build
|
|
174
|
+
- save-yarn-package-cache
|
|
175
|
+
- bundle-js
|
|
176
|
+
- aws-s3/sync:
|
|
177
|
+
from: ./lib
|
|
178
|
+
to: "s3://wasm-runner-sdk"
|
|
179
|
+
|
|
180
|
+
build-and-publish:
|
|
181
|
+
executor: node-lts
|
|
182
|
+
steps:
|
|
183
|
+
- attach_workspace:
|
|
184
|
+
at: *working-dir
|
|
185
|
+
- restore-yarn-cache
|
|
186
|
+
- install-dependencies
|
|
187
|
+
- build
|
|
188
|
+
- save-yarn-package-cache
|
|
189
|
+
- publish
|
|
190
|
+
|
|
191
|
+
build-and-publish-npm:
|
|
192
|
+
executor: node-lts
|
|
193
|
+
steps:
|
|
194
|
+
- checkout
|
|
195
|
+
- npm-config-set
|
|
196
|
+
- restore-yarn-cache
|
|
197
|
+
- install-dependencies
|
|
198
|
+
- build
|
|
199
|
+
- save-yarn-package-cache
|
|
200
|
+
- publish_npm
|