-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f91e109
commit 18f6df9
Showing
3 changed files
with
192 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
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 | ||
|
||
publish-to-npm: | ||
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: Transpile lib | ||
run: npm run build-lib | ||
|
||
- name: Setup registry access | ||
run: | | ||
echo '@optable:registry=https://registry.npmjs.org/' > ~/.npmrc | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc | ||
- name: List files in the repository | ||
run: | | ||
ls ${{ github.workspace }}/lib/dist | ||
ls ${{ github.workspace }}/browser/dist | ||
# - name: Publish to NPM | ||
# run: npm publish --dry-run | ||
# run: npm publish --access public | ||
|
||
deploy-demo: | ||
needs: [tests-prettier, publish-to-npm] | ||
runs-on: ubuntu-latest | ||
env: | ||
SDK_URI: https://cdn.optable.co/web-sdk/latest/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/npm | ||
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 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 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 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: List files in the repository | ||
run: | | ||
ls ${{ github.workspace }}/demos/vanilla | ||
ls ${{ github.workspace }}/demos/integration | ||
ls ${{ github.workspace }}/demos/ads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI to build the sdk | ||
on: workflow_call | ||
|
||
jobs: | ||
tests: | ||
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: Test | ||
run: npm run test | ||
|
||
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: Run prettier | ||
run: npm run format | ||
|
||
- name: Check if prettier changed files | ||
run: git diff --exit-code || (echo "ESLint fixed some files. Please commit the changes." && exit 1) |