Skip to content

Commit bc70551

Browse files
committed
chore: resolve merge conflicts
2 parents 3cfb676 + d9bfe5d commit bc70551

File tree

259 files changed

+12347
-9210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+12347
-9210
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: npm_install_from_cache
2+
description: Install npm packages from cache
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get cached dependencies
7+
id: cache-npm
8+
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c
9+
with:
10+
path: node_modules
11+
key: npm-${{ hashFiles('./package-lock.json') }}
12+
13+
- name: Install dependencies
14+
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
15+
run: npm ci
16+
shell: bash
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: Generate EU preview link
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize]
6+
branches:
7+
- '**'
8+
9+
env:
10+
NODE_OPTIONS: '--max-old-space-size=8192'
11+
12+
concurrency:
13+
group: cloudflare-eu-pages-build-${{github.head_ref}}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build_eu_to_cloudflare_pages:
18+
runs-on: Ubuntu-latest
19+
if: contains(github.event.pull_request.head.ref, 'multiple-build')
20+
permissions:
21+
checks: write
22+
pull-requests: write
23+
steps:
24+
- name: Verify user
25+
uses: 'deriv-com/shared-actions/.github/actions/verify_user_in_organization@v1'
26+
with:
27+
username: ${{github.event.pull_request.user.login}}
28+
token: ${{ secrets.PREVIEW_LINK_TOKEN }}
29+
30+
- name: Checkout to repo
31+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha }}
34+
35+
- name: 'Generate action link comment'
36+
id: generate_action_url
37+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
38+
with:
39+
github-token: ${{ github.token }}
40+
script: |
41+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
42+
const comment = [
43+
'| Name | Result |',
44+
'| :--- | :------ |',
45+
`| **EU Build status** | Building 🔨 |`,
46+
`| **EU Action URL** | [Visit Action](${action_url}) |`,
47+
''
48+
].join('\n')
49+
core.setOutput("comment", comment);
50+
51+
- name: Post Cloudflare Pages Preview comment
52+
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
53+
with:
54+
header: Cloudflare Pages EU Preview Comment
55+
number: ${{github.event.pull_request.user.login}}
56+
message: ${{steps.generate_action_url.outputs.comment}}
57+
recreate: true
58+
59+
- name: Setup node
60+
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8
61+
62+
- name: Create npmrc file
63+
shell: bash
64+
run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc
65+
66+
- name: Setup install read-only token for deriv-com org
67+
shell: bash
68+
run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc
69+
70+
- name: Get build output from master cache
71+
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c
72+
with:
73+
key: master-cache-public
74+
restore-keys: |
75+
master-cache-public-replica
76+
path: |
77+
sites/eu/.cache
78+
sites/eu/public
79+
80+
- name: Install Dependencies
81+
uses: "./.github/actions/npm_install_from_cache"
82+
83+
- name: Build project
84+
id: build-project
85+
env:
86+
GATSBY_ENV: staging
87+
GATSBY_GROWTHBOOK_CLIENT_KEY: ${{ secrets.GATSBY_GROWTHBOOK_CLIENT_KEY }}
88+
GATSBY_GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.GATSBY_GROWTHBOOK_DECRYPTION_KEY }}
89+
GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }}
90+
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
91+
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}
92+
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }}
93+
GATSBY_TRUSTPILOT_API_KEY: ${{ secrets.GATSBY_TRUSTPILOT_API_KEY }}
94+
GATSBY_HOTJAR_ID: ${{ secrets.GATSBY_HOTJAR_ID }}
95+
96+
run: npm run build:eu
97+
98+
- name: Retrieve PR information
99+
env:
100+
EVENT_NUMBER: ${{ github.event.number }}
101+
EVENT_USERNAME: ${{ github.event.pull_request.user.login }}
102+
HEAD_REF: ${{ github.head_ref }}
103+
run: |
104+
mkdir -p .pr
105+
echo "$EVENT_NUMBER" > .pr/NR
106+
echo "$EVENT_USERNAME" > .pr/USERNAME
107+
echo "$HEAD_REF" > .pr/BRANCHNAME
108+
109+
- name: Publish to Cloudflare Pages
110+
id: publish-to-pages
111+
env:
112+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }}
113+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }}
114+
HEAD_BRANCH: ${{ github.head_ref }}
115+
run: |
116+
echo "Installing Wrangler CLI"
117+
npm i -g wrangler
118+
echo "Deploying build to Cloudflare Pages"
119+
directory='sites/eu/public'
120+
projectName='deriv-com-preview-links'
121+
branch=eu-$(echo "$HEAD_BRANCH" | head -c 20 | sed 's/[\/_\.]/-/g; s/[^a-zA-Z0-9]$/1/')
122+
cf_preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
123+
echo "------"
124+
preview_url=https://$branch.deriv-com-preview-links.pages.dev
125+
cat log.txt
126+
if grep -q "Deployment complete" log.txt; then
127+
echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT"
128+
echo $preview_url > .pr/PREVIEW_URL
129+
else
130+
echo "Deployment to Cloudflare Pages failed."
131+
exit 1
132+
fi
133+
134+
- name: 'Generate preview link comment'
135+
if: success()
136+
id: generate_preview_url
137+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
138+
with:
139+
github-token: ${{ github.token }}
140+
script: |
141+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
142+
const preview_url = "${{steps.publish-to-pages.outputs.preview_url}}"
143+
const comment = [
144+
`**Preview Link**: ${preview_url}`,
145+
'| Name | Result |',
146+
'| :--- | :------ |',
147+
`| **EU Build status** | Completed ✅ |`,
148+
`| **EU Preview URL** | [Visit Preview](${preview_url}) |`,
149+
`| **EU Action URL** | [Visit Action](${action_url}) |`,
150+
''
151+
].join('\n')
152+
core.setOutput("comment", comment);
153+
- name: 'Generate failure comment'
154+
if: failure()
155+
id: generate_failure_comment
156+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
157+
with:
158+
github-token: ${{ github.token }}
159+
script: |
160+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
161+
const comment = [
162+
'| Name | Result |',
163+
'| :--- | :------ |',
164+
`| **EU Build status** | Failed ❌ |`,
165+
`| **EU Action URL** | [Visit Action](${action_url}) |`,
166+
''
167+
].join('\n')
168+
core.setOutput("comment", comment);
169+
- name: Post Cloudflare Pages Preview comment
170+
if: success() || failure()
171+
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
172+
with:
173+
header: Cloudflare Pages Preview Comment
174+
number: ${{github.event.number}}
175+
message: ${{steps.generate_preview_url.outputs.comment || steps.generate_failure_comment.outputs.comment }}
176+
recreate: true
177+
178+
- name: Upload PR information to artifact
179+
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
180+
with:
181+
name: 'pr-${{github.run_id}}'
182+
path: .pr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Generate ROW preview link
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize]
6+
branches:
7+
- '**'
8+
9+
env:
10+
NODE_OPTIONS: '--max-old-space-size=8192'
11+
12+
concurrency:
13+
group: cloudflare-row-pages-build-${{github.head_ref}}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build_row_to_cloudflare_pages:
18+
runs-on: Ubuntu-latest
19+
# To be removed once released in production
20+
if: contains(github.event.pull_request.head.ref, 'multiple-build')
21+
permissions:
22+
checks: write
23+
pull-requests: write
24+
steps:
25+
- name: Verify user
26+
uses: 'deriv-com/shared-actions/.github/actions/verify_user_in_organization@v1'
27+
with:
28+
username: ${{github.event.pull_request.user.login}}
29+
token: ${{ secrets.PREVIEW_LINK_TOKEN }}
30+
31+
- name: Checkout to repo
32+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
33+
with:
34+
ref: ${{ github.event.pull_request.head.sha }}
35+
36+
- name: 'Generate action link comment'
37+
id: generate_action_url
38+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
39+
with:
40+
github-token: ${{ github.token }}
41+
script: |
42+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
43+
const comment = [
44+
'| Name | Result |',
45+
'| :--- | :------ |',
46+
`| **ROW Build status** | Building 🔨 |`,
47+
`| **ROW Action URL** | [Visit Action](${action_url}) |`,
48+
''
49+
].join('\n')
50+
core.setOutput("comment", comment);
51+
52+
- name: Post Cloudflare Pages Preview comment
53+
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
54+
with:
55+
header: Cloudflare Pages ROW Preview Comment
56+
number: ${{github.event.pull_request.user.login}}
57+
message: ${{steps.generate_action_url.outputs.comment}}
58+
recreate: true
59+
60+
- name: Setup node
61+
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8
62+
63+
- name: Create npmrc file
64+
shell: bash
65+
run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc
66+
67+
- name: Setup install read-only token for deriv-com org
68+
shell: bash
69+
run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc
70+
71+
- name: Get build output from master cache
72+
uses: actions/cache/restore@e12d46a63a90f2fae62d114769bbf2a179198b5c
73+
with:
74+
key: master-cache-public
75+
restore-keys: |
76+
master-cache-public-replica
77+
path: |
78+
sites/row/.cache
79+
sites/row/public
80+
81+
- name: Install Dependencies
82+
uses: "./.github/actions/npm_install_from_cache"
83+
84+
- name: Build project
85+
id: build-project
86+
env:
87+
GATSBY_ENV: staging
88+
GATSBY_GROWTHBOOK_CLIENT_KEY: ${{ secrets.GATSBY_GROWTHBOOK_CLIENT_KEY }}
89+
GATSBY_GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.GATSBY_GROWTHBOOK_DECRYPTION_KEY }}
90+
GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }}
91+
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
92+
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}
93+
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }}
94+
GATSBY_TRUSTPILOT_API_KEY: ${{ secrets.GATSBY_TRUSTPILOT_API_KEY }}
95+
GATSBY_HOTJAR_ID: ${{ secrets.GATSBY_HOTJAR_ID }}
96+
97+
run: npm run build:row
98+
99+
- name: Retrieve PR information
100+
env:
101+
EVENT_NUMBER: ${{ github.event.number }}
102+
EVENT_USERNAME: ${{ github.event.pull_request.user.login }}
103+
HEAD_REF: ${{ github.head_ref }}
104+
run: |
105+
mkdir -p .pr
106+
echo "$EVENT_NUMBER" > .pr/NR
107+
echo "$EVENT_USERNAME" > .pr/USERNAME
108+
echo "$HEAD_REF" > .pr/BRANCHNAME
109+
110+
- name: Publish to Cloudflare Pages
111+
id: publish-to-pages
112+
env:
113+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }}
114+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }}
115+
HEAD_BRANCH: ${{ github.head_ref }}
116+
run: |
117+
echo "Installing Wrangler CLI"
118+
npm i -g wrangler
119+
echo "Deploying build to Cloudflare Pages"
120+
directory='sites/row/public'
121+
projectName='deriv-com-preview-links'
122+
branch=row-$(echo "$HEAD_BRANCH" | head -c 20 | sed 's/[\/_\.]/-/g; s/[^a-zA-Z0-9]$/1/')
123+
cf_preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
124+
echo "------"
125+
preview_url=https://$branch.deriv-com-preview-links.pages.dev
126+
cat log.txt
127+
if grep -q "Deployment complete" log.txt; then
128+
echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT"
129+
echo $preview_url > .pr/PREVIEW_URL
130+
else
131+
echo "Deployment to Cloudflare Pages failed."
132+
exit 1
133+
fi
134+
135+
- name: 'Generate preview link comment'
136+
if: success()
137+
id: generate_preview_url
138+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
139+
with:
140+
github-token: ${{ github.token }}
141+
script: |
142+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
143+
const preview_url = "${{steps.publish-to-pages.outputs.preview_url}}"
144+
const comment = [
145+
`**Preview Link**: ${preview_url}`,
146+
'| Name | Result |',
147+
'| :--- | :------ |',
148+
`| **ROW Build status** | Completed ✅ |`,
149+
`| **ROW Preview URL** | [Visit Preview](${preview_url}) |`,
150+
`| **ROW Action URL** | [Visit Action](${action_url}) |`,
151+
''
152+
].join('\n')
153+
core.setOutput("comment", comment);
154+
- name: 'Generate failure comment'
155+
if: failure()
156+
id: generate_failure_comment
157+
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736
158+
with:
159+
github-token: ${{ github.token }}
160+
script: |
161+
const action_url = "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
162+
const comment = [
163+
'| Name | Result |',
164+
'| :--- | :------ |',
165+
`| **ROW Build status** | Failed ❌ |`,
166+
`| **ROW Action URL** | [Visit Action](${action_url}) |`,
167+
''
168+
].join('\n')
169+
core.setOutput("comment", comment);
170+
- name: Post Cloudflare Pages Preview comment
171+
if: success() || failure()
172+
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
173+
with:
174+
header: Cloudflare Pages Preview Comment
175+
number: ${{github.event.number}}
176+
message: ${{steps.generate_preview_url.outputs.comment || steps.generate_failure_comment.outputs.comment }}
177+
recreate: true
178+
179+
- name: Upload PR information to artifact
180+
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
181+
with:
182+
name: 'pr-${{github.run_id}}'
183+
path: .pr

.github/workflows/generate-preview-link.yml

+2
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ jobs:
106106
EVENT_NUMBER: ${{ github.event.number }}
107107
EVENT_USERNAME: ${{ github.event.pull_request.user.login }}
108108
HEAD_REF: ${{ github.head_ref }}
109+
DRAFT: ${{ github.event.pull_request.draft }}
109110
run: |
110111
mkdir -p .pr
111112
echo "$EVENT_NUMBER" > .pr/NR
112113
echo "$EVENT_USERNAME" > .pr/USERNAME
113114
echo "$HEAD_REF" > .pr/BRANCHNAME
115+
echo "$DRAFT" > .pr/DRAFT
114116
115117
- name: Publish to Cloudflare Pages
116118
id: publish-to-pages

0 commit comments

Comments
 (0)