-
Notifications
You must be signed in to change notification settings - Fork 2
324 lines (280 loc) · 12.4 KB
/
release.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
name: Release new version of Optable SDK and demos
on:
push:
branches:
- migrate-to-gh-actions
# push:
# tags:
# - 'v.*'
jobs:
tests-prettier:
uses: ./.github/workflows/reusable-lint-test.yml
build-web:
needs: [tests-prettier]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build web production
run: npm run build-web -- --mode=production
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-web
path: browser/dist
build-lib:
needs: [tests-prettier]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Transpile lib
run: npm run build-lib
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-lib
path: lib/dist
build-vanilla-demo:
needs: [tests-prettier]
runs-on: ubuntu-latest
defaults:
run:
working-directory: demos
env:
SDK_URI: https://cdn.optable.co/web-sdk/${{ github.ref_name }}/sdk.js
ADS_HOST: ads.optable.co
ADS_REGION: ca
ADS_SITE: 4fe7c1ce-7c7d-4718-a0b8-5195e489319f
DCN_HOST: sandbox.optable.co
DCN_SITE: web-sdk-demo
DCN_ID: optable
DCN_INSECURE: "false"
DCN_INIT: "true"
UID2_BASE_URL: https://operator-integ.uidapi.com
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build vanilla demo
run: |
export SDK_URI=${{ env.SDK_URI }}
export DCN_HOST=${{ env.DCN_HOST }}
export DCN_SITE=${{ env.DCN_SITE }}
export DCN_ID=${{ env.DCN_ID }}
export DCN_INSECURE=${{ env.DCN_INSECURE }}
export DCN_INIT=${{ env.DCN_INIT }}
export ADS_SITE=${{ env.ADS_SITE }}
export ADS_HOST=${{ env.ADS_HOST }}
export ADS_REGION=${{ env.ADS_REGION }}
export UID2_BASE_URL=${{ env.UID2_BASE_URL }}
envsubst < vanilla/identify.html.tpl > vanilla/identify.html
envsubst < vanilla/witness.html.tpl > vanilla/witness.html
envsubst < vanilla/profile.html.tpl > vanilla/profile.html
envsubst < vanilla/targeting/gam360.html.tpl > vanilla/targeting/gam360.html
envsubst < vanilla/targeting/gam360-cached.html.tpl > vanilla/targeting/gam360-cached.html
envsubst < vanilla/targeting/prebid.html.tpl > vanilla/targeting/prebid.html
envsubst < vanilla/nocookies/identify.html.tpl > vanilla/nocookies/identify.html
envsubst < vanilla/nocookies/witness.html.tpl > vanilla/nocookies/witness.html
envsubst < vanilla/nocookies/profile.html.tpl > vanilla/nocookies/profile.html
envsubst < vanilla/nocookies/targeting/gam360.html.tpl > vanilla/nocookies/targeting/gam360.html
envsubst < vanilla/nocookies/targeting/gam360-cached.html.tpl > vanilla/nocookies/targeting/gam360-cached.html
envsubst < vanilla/nocookies/targeting/prebid.html.tpl > vanilla/nocookies/targeting/prebid.html
envsubst < integration/lmpid-prebid-gpt.html.tpl > integration/lmpid-prebid-gpt.html
envsubst < integration/lmpid-signal-gpt.html.tpl > integration/lmpid-signal-gpt.html
envsubst < ads/protected-audience/advertiser.html.tpl > ads/protected-audience/advertiser.html
envsubst < ads/protected-audience/publisher.html.tpl > ads/protected-audience/publisher.html
envsubst < ads/protected-audience/publisher-gam.html.tpl > ads/protected-audience/publisher-gam.html
envsubst < ads/protected-audience/publisher-prebid.html.tpl > ads/protected-audience/publisher-prebid.html
envsubst < ads/protected-audience/ad.html.tpl > ads/protected-audience/ad.html
envsubst < ads/topics/publisher.html.tpl > ads/topics/publisher.html
envsubst < vanilla/uid2_token/login.html.tpl > vanilla/uid2_token/login.html
envsubst < vanilla/uid2_token/index.html.tpl > vanilla/uid2_token/index.html
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-demo-vanilla
path: demos/**/*.html
build-react-demo:
needs: [build-lib]
runs-on: ubuntu-latest
defaults:
run:
working-directory: demos/react
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download web artifacts
uses: actions/download-artifact@v4
with:
name: dist-lib
path: lib/dist
- name: Cache react demo dependencies
id: cache-node-modules-react-demo
uses: actions/cache@v4
with:
path: demos/react/node_modules
key: node-demo-react-${{ hashFiles('demos/react/package-lock.json') }}
- name: Install react demo dependencies
if: steps.cache-node-modules-react-demo.outputs.cache-hit != 'true'
run: npm ci
- name: Build react demo
run: npm run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-react-demo
path: demos/react/dist/**/*
build-npm-demo:
needs: [tests-prettier]
runs-on: ubuntu-latest
defaults:
run:
working-directory: demos/npm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache npm-demo dependencies
id: cache-node-modules-npm-demo
uses: actions/cache@v4
with:
path: demos/npm/node_modules
key: node-npm-react-${{ hashFiles('demos/npm/package-lock.json') }}
- name: Install npm-demo dependencies
if: steps.cache-node-modules-npm-demo.outputs.cache-hit != 'true'
run: npm ci
- name: Build npm-demo
run: npm run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-npm-demo
path: demos/npm/dist/**/*
publish-to-npm:
needs: [build-web, build-lib]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download web artifacts
uses: actions/download-artifact@v4
with:
name: dist-web
path: browser/dist
- name: Download lib artifacts
uses: actions/download-artifact@v4
with:
name: dist-web
path: lib/dist
# Step will fail if the version is invalid, github.ref_name is the tag name (v.*.*.*)
- name: Patch version
run: ./scripts/patch-version.sh v0.0.0-${{ github.run_number }}
# run: ./scripts/patch-version.sh "${{ github.ref_name }}"
- name: Setup registry access
run: |
echo '@optable:registry=https://registry.npmjs.org/' > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
- name: Publish to NPM
run: npm publish --dry-run
# run: npm publish --access public
# deploy-demo:
# needs: [build-web, build-vanilla-demo, build-react-demo, build-npm-demo]
# runs-on: ubuntu-latest
# env:
# SDK_URI: https://cdn.optable.co/web-sdk/${{ github.ref_name }}/sdk.js
# ADS_HOST: ads.optable.co
# ADS_REGION: ca
# ADS_SITE: 4fe7c1ce-7c7d-4718-a0b8-5195e489319f
# DCN_HOST: sandbox.optable.co
# DCN_SITE: web-sdk-demo
# DCN_ID: optable
# DCN_INSECURE: "false"
# DCN_INIT: "true"
# UID2_BASE_URL: https://operator-integ.uidapi.com
# DEMO_REACT_PATH: demos/react
# DEMO_NPM_PATH: demos/npm
# permissions:
# packages: write
# contents: read
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Build vanilla demo
# run: |
# export SDK_URI=${{ env.SDK_URI }}
# export DCN_HOST=${{ env.DCN_HOST }}
# export DCN_SITE=${{ env.DCN_SITE }}
# export DCN_ID=${{ env.DCN_ID }}
# export DCN_INSECURE=${{ env.DCN_INSECURE }}
# export DCN_INIT=${{ env.DCN_INIT }}
# export ADS_SITE=${{ env.ADS_SITE }}
# export ADS_HOST=${{ env.ADS_HOST }}
# export ADS_REGION=${{ env.ADS_REGION }}
# export UID2_BASE_URL=${{ env.UID2_BASE_URL }}
# envsubst < demos/vanilla/identify.html.tpl > demos/vanilla/identify.html
# envsubst < demos/vanilla/witness.html.tpl > demos/vanilla/witness.html
# envsubst < demos/vanilla/profile.html.tpl > demos/vanilla/profile.html
# envsubst < demos/vanilla/targeting/gam360.html.tpl > demos/vanilla/targeting/gam360.html
# envsubst < demos/vanilla/targeting/gam360-cached.html.tpl > demos/vanilla/targeting/gam360-cached.html
# envsubst < demos/vanilla/targeting/prebid.html.tpl > demos/vanilla/targeting/prebid.html
# envsubst < demos/vanilla/nocookies/identify.html.tpl > demos/vanilla/nocookies/identify.html
# envsubst < demos/vanilla/nocookies/witness.html.tpl > demos/vanilla/nocookies/witness.html
# envsubst < demos/vanilla/nocookies/profile.html.tpl > demos/vanilla/nocookies/profile.html
# envsubst < demos/vanilla/nocookies/targeting/gam360.html.tpl > demos/vanilla/nocookies/targeting/gam360.html
# envsubst < demos/vanilla/nocookies/targeting/gam360-cached.html.tpl > demos/vanilla/nocookies/targeting/gam360-cached.html
# envsubst < demos/vanilla/nocookies/targeting/prebid.html.tpl > demos/vanilla/nocookies/targeting/prebid.html
# envsubst < demos/integration/lmpid-prebid-gpt.html.tpl > demos/integration/lmpid-prebid-gpt.html
# envsubst < demos/integration/lmpid-signal-gpt.html.tpl > demos/integration/lmpid-signal-gpt.html
# envsubst < demos/ads/protected-audience/advertiser.html.tpl > demos/ads/protected-audience/advertiser.html
# envsubst < demos/ads/protected-audience/publisher.html.tpl > demos/ads/protected-audience/publisher.html
# envsubst < demos/ads/protected-audience/publisher-gam.html.tpl > demos/ads/protected-audience/publisher-gam.html
# envsubst < demos/ads/protected-audience/publisher-prebid.html.tpl > demos/ads/protected-audience/publisher-prebid.html
# envsubst < demos/ads/protected-audience/ad.html.tpl > demos/ads/protected-audience/ad.html
# envsubst < demos/ads/topics/publisher.html.tpl > demos/ads/topics/publisher.html
# envsubst < demos/vanilla/uid2_token/login.html.tpl > demos/vanilla/uid2_token/login.html
# envsubst < demos/vanilla/uid2_token/index.html.tpl > demos/vanilla/uid2_token/index.html
# - name: Cache react demo dependencies
# id: cache-node-modules-react-demo
# uses: actions/cache@v4
# with:
# path: ${{ env.DEMO_REACT_PATH }}/node_modules
# key: node-demo-react-${{ hashFiles('demos/react/package-lock.json') }}
# - name: Install react demo dependencies
# if: steps.cache-node-modules-react-demo.outputs.cache-hit != 'true'
# run: npm --prefix ${{ env.DEMO_REACT_PATH }} ci
# - name: Build react demo
# run: npm --prefix ${{ env.DEMO_REACT_PATH }} run build
# - name: Cache npm demo dependencies
# id: cache-node-modules-npm-demo
# uses: actions/cache@v4
# with:
# path: ${{ env.DEMO_NPM_PATH }}/node_modules
# key: node-demo-npm-${{ hashFiles('demos/npm/package-lock.json') }}
# - name: Install npm demo dependencies
# if: steps.cache-node-modules-npm-demo.outputs.cache-hit != 'true'
# run: npm --prefix ${{ env.DEMO_NPM_PATH }} ci
# - name: Build npm demo
# run: npm --prefix ${{ env.DEMO_NPM_PATH }} run build
# - name: Get sdk artifact
# uses: actions/download-artifact@v4
# with:
# name: dist-sdk
# # - name: Deploy to GCS
# # run: ./scripts/gs-publish.sh gs://optable-web-sdk ./browser/dist/sdk.js "${{ github.ref_name }}"