Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
aswathy-deriv committed Sep 12, 2023
2 parents 1e26ffc + 79313f0 commit b798d18
Show file tree
Hide file tree
Showing 219 changed files with 16,203 additions and 44,691 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/build-to-cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build to Cloudflare Pages

permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write

on:
pull_request:
types: [opened, synchronize]

env:
NODE_OPTIONS: '--max-old-space-size=8192'

concurrency:
group: cloudflare-pages-build-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build_to_cloudflare_pages:
runs-on: Ubuntu-latest
steps:
- name: Checkout to repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup node
uses: actions/setup-node@v2

- name: Generate build status comment
id: build_status_comment
uses: actions/github-script@v3
with:
script: |
const preview_url = "https://" + "${{ github.head_ref }}" + ".deriv-com.pages.dev"
const comment = [
'## Cloudflare Pages Preview link',
'| Name | Result |',
'| :--- | :------ |',
`| **Build status** | In progress ⏳ |`,
`| **Preview URL** | [Visit Preview](${preview_url}) |`,
''
].join('\n')
core.setOutput("comment", comment);
- name: Update build status comment
uses: marocchino/sticky-pull-request-comment@v2
with:
only_update: true
header: Cloudflare Pages Preview Comment
number: ${{github.event.issue.number}}
message: ${{steps.build_status_comment.outputs.comment}}

- name: Get build output from master cache
uses: actions/cache/restore@v3
with:
key: master-cache-public
restore-keys: |
master-cache-public-replica
path: |
.cache
public
- name: Get cached dependencies
id: cache-npm
uses: actions/cache/restore@v3
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci

- name: Build project
id: build-project
run: npm run build

- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]

with:
apiToken: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }}
command: pages publish public --project-name=deriv-com --branch=${GITHUB_REF_NAME}
echo "preview_url=$(pages info --project-name=deriv-com --branch=${GITHUB_REF_NAME} --format preview_url)" >> $GITHUB_OUTPUT

- name: Retrieve Cloudflare Pages Preview URL
id: cloudflare_pages_preview_url
uses: actions/github-script@v3
with:
script: |
const preview_url = "${{ steps.publish-to-pages.outputs.preview_url }}"
const comment = [
'| Name | Result |',
'| :--- | :------ |',
`| **Build status** | Completed ✅ |`,
`| **Preview URL** | [Visit Preview](${preview_url}) |`,
''
].join('\n')
core.setOutput("comment", comment);
- name: Post Cloudflare Pages Preview comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Cloudflare Pages Preview Comment
number: ${{github.event.issue.number}}
message: ${{steps.cloudflare_pages_preview_url.outputs.comment}}
102 changes: 102 additions & 0 deletions .github/workflows/sync-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Sync build cache

permissions:
actions: write
contents: read

on:
schedule:
- cron: '0 22 * * *'
workflow_dispatch:

env:
NODE_OPTIONS: '--max-old-space-size=8192'

concurrency:
group: sync-build-cache
cancel-in-progress: false

jobs:
validate-master-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout to repo
uses: actions/checkout@v3
with:
ref: master

- name: Setup node
uses: actions/setup-node@v2

- name: Get cached dependencies
id: cache-npm
uses: actions/cache/restore@v3
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci

- name: Save cached dependencies
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
key: ${{ steps.cache-npm.outputs.cache-primary-key }}
path: node_modules

- name: Get master cache
id: restore-master-cache
uses: actions/cache/restore@v3
with:
key: master-cache-public
path: |
.cache
public
- name: Clear master cache
if: ${{ steps.restore-master-cache.outputs.cache-hit == 'true' }}
run: |
owner="binary-com"
repo="deriv-com"
cache_key="${{ steps.restore-master-cache.outputs.cache-matched-key }}"
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ github.token }}" \
https://api.github.com/repos/$owner/$repo/actions/caches?key=$cache_key
- name: Rebuild master cache
id: build-cache
run: npm run build

- name: Save master cache
if: ${{ steps.build-cache.outcome == 'success' }}
uses: actions/cache/save@v3
with:
key: master-cache-public
path: |
.cache
public
- name: Clear backup cache
if: ${{ steps.build-cache.outcome == 'success' }}
run: |
owner="binary-com"
repo="deriv-com"
cache_key="master-cache-public-replica"
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ github.token }}" \
https://api.github.com/repos/$owner/$repo/actions/caches?key=$cache_key
- name: Sync backup cache with master cache
if: ${{ steps.build-cache.outcome == 'success' }}
uses: actions/cache/save@v3
with:
key: master-cache-public-replica
path: |
.cache
public
2 changes: 1 addition & 1 deletion .github/workflows/translation-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
with:
node-version: '16.x'
- name: Installing Crowdin
run: npm i -g @crowdin/cli@3.7.8
run: npm i -g @crowdin/cli@3.14.0
- name: Download New Translations ⬇️
if: github.event.workflow_run.head_commit.message == 'auto-pull-translation'
run: |
Expand Down
Loading

0 comments on commit b798d18

Please sign in to comment.