From 899e93d757fb61ed81f3030cc77064261950fed8 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:19:14 +0800 Subject: [PATCH 01/42] ci: add vercel upload action --- .github/actions/deploy-to-vercel/action.yml | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/actions/deploy-to-vercel/action.yml diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml new file mode 100644 index 000000000..9490c11e2 --- /dev/null +++ b/.github/actions/deploy-to-vercel/action.yml @@ -0,0 +1,48 @@ +name: Deploy to Vercel +description: Deploy to Vercel +inputs: + VERCEL_ORG_ID: + description: Vercel organization ID + required: true + VERCEL_PROJECT_ID: + description: Vercel project ID + required: true + VERCEL_TOKEN: + description: Vercel token + required: true + ENVIRONMENT: + description: Environment + required: true + +runs: + using: composite + steps: + - name: Install Vercel CLI + run: npm install -g vercel + shell: bash + + - name: Authenticate with Vercel + env: + VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} + run: vercel login --token ${{ env.VERCEL_TOKEN }} + shell: bash + + - name: Deploy to Vercel (Staging) + if: ${{ inputs.ENVIRONMENT == 'staging' }} + shell: bash + env: + VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} + run: | + url="$vercel deploy --cwd build" + vercel alias set "$url" staging-api.binary.sx + + - name: Deploy to Vercel (Production) + if: ${{ inputs.ENVIRONMENT == 'production' }} + shell: bash + env: + VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} + run: | + url="$vercel deploy --cwd build" + vercel alias set "$url" api.binary.sx From 09b15aa58a2b26361e1cab8ae0387eb37ceb0a42 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:19:44 +0800 Subject: [PATCH 02/42] ci: add a temp gh workflow to test vercel upload action --- .github/workflows/vercel-test.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/vercel-test.yml diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml new file mode 100644 index 000000000..84fa58f96 --- /dev/null +++ b/.github/workflows/vercel-test.yml @@ -0,0 +1,38 @@ +name: Deriv Api Docs Production Workflow +on: + pull_request: + branches: + - master +env: + RELEASE_TYPE: Production +jobs: + build_and_publish: + name: Builds and Publishes to Cloudflare Pages Production + environment: Production + runs-on: ubuntu-latest + outputs: + RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Setup Node + uses: ./.github/actions/setup_node + - name: Install dependencies + uses: ./.github/actions/npm_install_from_cache + - name: Build + uses: ./.github/actions/build + with: + NODE_ENV: production + TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }} + - name: Versioning + uses: ./.github/actions/versioning + with: + RELEASE_TAG: ${{ github.ref_name }} + RELEASE_TYPE: ${{ env.RELEASE_TYPE }} + - name: Upload to vercel + uses: ./.github/actions/deploy-to-vercel + with: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} + ENVIRONMENT: staging From c3c9ff776aed85e07ac6c0058c371cc796b40ad7 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:21:41 +0800 Subject: [PATCH 03/42] ci: rename the test workflow --- .github/workflows/vercel-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml index 84fa58f96..108be06e6 100644 --- a/.github/workflows/vercel-test.yml +++ b/.github/workflows/vercel-test.yml @@ -1,4 +1,4 @@ -name: Deriv Api Docs Production Workflow +name: Deriv Api Docs Vercel Workflow on: pull_request: branches: @@ -7,8 +7,8 @@ env: RELEASE_TYPE: Production jobs: build_and_publish: - name: Builds and Publishes to Cloudflare Pages Production - environment: Production + name: Builds and Publishes to Vercel + environment: Staging runs-on: ubuntu-latest outputs: RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} From 5a500addd975735462cedc50c8e7f366f63d2df0 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:27:56 +0800 Subject: [PATCH 04/42] ci: use token instead of login --- .github/actions/deploy-to-vercel/action.yml | 16 ++++++---------- .github/workflows/vercel-test.yml | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 9490c11e2..4355a75fd 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -21,28 +21,24 @@ runs: run: npm install -g vercel shell: bash - - name: Authenticate with Vercel - env: - VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} - run: vercel login --token ${{ env.VERCEL_TOKEN }} - shell: bash - - name: Deploy to Vercel (Staging) - if: ${{ inputs.ENVIRONMENT == 'staging' }} + if: ${{ inputs.ENVIRONMENT == 'Staging' }} shell: bash env: VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$vercel deploy --cwd build" + url="$(vercel deploy --cwd build --token=$VERCEL_TOKEN)" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) - if: ${{ inputs.ENVIRONMENT == 'production' }} + if: ${{ inputs.ENVIRONMENT == 'Production' }} shell: bash env: VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$vercel deploy --cwd build" + url="$(vercel deploy --cwd build --token=$VERCEL_TOKEN)" vercel alias set "$url" api.binary.sx diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml index 108be06e6..dd622a314 100644 --- a/.github/workflows/vercel-test.yml +++ b/.github/workflows/vercel-test.yml @@ -35,4 +35,4 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} - ENVIRONMENT: staging + ENVIRONMENT: Staging From ebf5a76d1e363b36469e63f85d047dcb41e95201 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:37:37 +0800 Subject: [PATCH 05/42] ci: add prebuilt flag to prevent vercel build --- .github/actions/deploy-to-vercel/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 4355a75fd..ff75fa1ad 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,7 +29,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --cwd build --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd build --token=$VERCEL_TOKEN)" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -40,5 +40,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --cwd build --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd build --token=$VERCEL_TOKEN)" vercel alias set "$url" api.binary.sx From 81edf159853c846902dcbe20c003088c6c3da243 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:43:23 +0800 Subject: [PATCH 06/42] build: update vercel.json file --- vercel.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/vercel.json b/vercel.json index bd6fd8faa..84c68ef7b 100644 --- a/vercel.json +++ b/vercel.json @@ -1,3 +1,14 @@ { - "cleanUrls": true -} + "cleanUrls": true, + "version": 2, + "builds": [ + { + "src": "package.json", + "use": "@vercel/static-build", + "config": { + "distDir": "build" + } + } + ], + "outputDirectory": ".vercel/output" +} \ No newline at end of file From d19c399331e097dceb7828b1946434f7a3d21247 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 16:45:21 +0800 Subject: [PATCH 07/42] build: vercel build before publish --- .github/actions/deploy-to-vercel/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index ff75fa1ad..2891330ca 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -21,6 +21,10 @@ runs: run: npm install -g vercel shell: bash + - name: Generate Vercel output + run: vercel build --cwd build --output .vercel/output + shell: bash + - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} shell: bash @@ -29,7 +33,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd build --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=$VERCEL_TOKEN)" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -40,5 +44,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd build --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=$VERCEL_TOKEN)" vercel alias set "$url" api.binary.sx From dd96264ba2ba67ab04dfd028e99cea670ff528c8 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 17:14:29 +0800 Subject: [PATCH 08/42] ci: pull vercel project before --- .github/actions/deploy-to-vercel/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 2891330ca..91e49150c 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -22,8 +22,12 @@ runs: shell: bash - name: Generate Vercel output - run: vercel build --cwd build --output .vercel/output shell: bash + env: + VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} + run: | + vercel pull --yes --token=$VERCEL_TOKEN + vercel build --cwd build --output .vercel/output - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 90bde893d03db3eb0b43c99932d1567197c32f74 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 17:25:15 +0800 Subject: [PATCH 09/42] ci: trigger workflow From ac08379840b03b28162162b39b2b4269b2c64127 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 17:41:23 +0800 Subject: [PATCH 10/42] ci: add token to build command --- .github/actions/deploy-to-vercel/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 91e49150c..4fd462833 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -27,7 +27,7 @@ runs: VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | vercel pull --yes --token=$VERCEL_TOKEN - vercel build --cwd build --output .vercel/output + vercel build --cwd build --token=$VERCEL_TOKEN - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 2851d830f441bae957860eb1761c201a5132be66 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 17:55:26 +0800 Subject: [PATCH 11/42] ci: use token from env --- .github/actions/deploy-to-vercel/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 4fd462833..f529517b9 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -26,8 +26,8 @@ runs: env: VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - vercel pull --yes --token=$VERCEL_TOKEN - vercel build --cwd build --token=$VERCEL_TOKEN + vercel pull --yes --token=${{ env.VERCEL_TOKEN }} + vercel build --cwd build --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -37,7 +37,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -48,5 +48,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=$VERCEL_TOKEN)" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" api.binary.sx From 823b1790f658b73442ed4be31f41472bb41370cf Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 18:02:48 +0800 Subject: [PATCH 12/42] ci: manually copy the built file to vercel dir --- .github/actions/deploy-to-vercel/action.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index f529517b9..df14db049 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -23,11 +23,9 @@ runs: - name: Generate Vercel output shell: bash - env: - VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --cwd build --token=${{ env.VERCEL_TOKEN }} + mkdir -p .vercel/output + cp -r build/* .vercel/output/ - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From d6c86acaa854b2528b038a1f12af7654db89361f Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 19:09:33 +0800 Subject: [PATCH 13/42] ci: add vercel secrets to build step --- .github/actions/deploy-to-vercel/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index df14db049..3b03fd737 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -22,10 +22,14 @@ runs: shell: bash - name: Generate Vercel output + env: + VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ inputs.VERCEL_API_TOKEN }} shell: bash run: | - mkdir -p .vercel/output - cp -r build/* .vercel/output/ + vercel pull --yes --token=${{ env.VERCEL_TOKEN }} + vercel build --yes --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 90553bc2f17d857a6ae88fe778a1593dc4d27a05 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 24 Jun 2024 19:14:41 +0800 Subject: [PATCH 14/42] ci: add cwd dir --- .github/actions/deploy-to-vercel/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 3b03fd737..e66dce626 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -25,11 +25,11 @@ runs: env: VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} - VERCEL_TOKEN: ${{ inputs.VERCEL_API_TOKEN }} + VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --yes --token=${{ env.VERCEL_TOKEN }} + vercel build --yes --cwd build --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 267c1cc01b86c74e6bfd34521cd51dc55f87e619 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 11:38:16 +0800 Subject: [PATCH 15/42] ci: remove the build step --- .github/actions/deploy-to-vercel/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index e66dce626..5d48b0532 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,7 +29,6 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --yes --cwd build --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From f48e77200818089119fddd268d37b79e554c3a02 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 12:09:19 +0800 Subject: [PATCH 16/42] ci: use the build directory --- .github/actions/deploy-to-vercel/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 5d48b0532..a8af0a60f 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -38,7 +38,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --cwd build --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -49,5 +49,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --cwd build --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" api.binary.sx From 6c264abd8d00e634b02916585daab9303d6d07fe Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 12:28:05 +0800 Subject: [PATCH 17/42] ci: add build step --- .github/actions/deploy-to-vercel/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index a8af0a60f..cb17151b6 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,6 +29,7 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} + vercel build --yes - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -38,7 +39,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd build --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -49,5 +50,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd build --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" api.binary.sx From 82190ae166b52897af87d57a7b29b2adee7bf862 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 12:54:01 +0800 Subject: [PATCH 18/42] ci: remove cwd flag --- .github/actions/deploy-to-vercel/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index cb17151b6..fadc7b5b8 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -39,7 +39,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" staging-api.binary.sx - name: Deploy to Vercel (Production) @@ -50,5 +50,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --cwd .vercel/output --token=${{ env.VERCEL_TOKEN }})" + url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" api.binary.sx From 6c31fde6351edd1765626d7f22c5f2a14b7a5705 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 13:08:47 +0800 Subject: [PATCH 19/42] ci: add vercel token --- .github/actions/deploy-to-vercel/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index fadc7b5b8..e2db7a4bf 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,7 +29,7 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --yes + vercel build --yes --cwd build - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -40,7 +40,7 @@ runs: VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" - vercel alias set "$url" staging-api.binary.sx + vercel alias set "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Production) if: ${{ inputs.ENVIRONMENT == 'Production' }} @@ -51,4 +51,4 @@ runs: VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" - vercel alias set "$url" api.binary.sx + vercel alias set "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} From ae3fca1f3de6a83839ebaf953ff98674a749f970 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 13:13:50 +0800 Subject: [PATCH 20/42] ci: add token to build step --- .github/actions/deploy-to-vercel/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index e2db7a4bf..f5f2d21dc 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,7 +29,7 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --yes --cwd build + vercel build --yes --token=${{ env.VERCEL_TOKEN }} - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From dab293be1baa67f3b131d064e133b884677d1364 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 15:45:44 +0800 Subject: [PATCH 21/42] trigger From eb07316ba81e0935939ed1121a650c0814b4abe0 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 16:04:12 +0800 Subject: [PATCH 22/42] ci: cat project.json file --- .github/actions/deploy-to-vercel/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index f5f2d21dc..dc7e90540 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -39,6 +39,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | + cat .vercel/project.json url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" vercel alias set "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} From 3d7ce76e0bcd96bcd5e2ea81f2eebb85d9256243 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 16:41:08 +0800 Subject: [PATCH 23/42] ci: add scope --- .github/actions/deploy-to-vercel/action.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index dc7e90540..3fa92e19d 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -28,8 +28,8 @@ runs: VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} shell: bash run: | - vercel pull --yes --token=${{ env.VERCEL_TOKEN }} - vercel build --yes --token=${{ env.VERCEL_TOKEN }} + vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv + vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -39,9 +39,8 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - cat .vercel/project.json - url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" - vercel alias set "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} + url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" + vercel alias "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Production) if: ${{ inputs.ENVIRONMENT == 'Production' }} @@ -51,5 +50,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }})" - vercel alias set "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} + url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" + vercel alias "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv From b85138f78b968af260a0e48e58db6e87ac423f72 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 17:16:59 +0800 Subject: [PATCH 24/42] ci: copy build files manually --- .github/actions/deploy-to-vercel/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 3fa92e19d..5a4869d37 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,7 +29,9 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv + mkdir -p .vercel/output/static + cp -r build/* .vercel/output/static + # vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From c4b4b049a04f6ca24b2f648e1a6e205825ba6aa4 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 17:56:28 +0800 Subject: [PATCH 25/42] ci: use gh workflow static files --- .github/actions/deploy-to-vercel/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 5a4869d37..46cf37285 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -30,8 +30,9 @@ runs: run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv mkdir -p .vercel/output/static + vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv + rm -rf .vercel/output/static cp -r build/* .vercel/output/static - # vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 2f770c034c2095e9a3d9fbaa8101870a6ef9a01c Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 25 Jun 2024 18:04:49 +0800 Subject: [PATCH 26/42] ci: fix static not found error --- .github/actions/deploy-to-vercel/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 46cf37285..39d465d3e 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -29,10 +29,9 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - mkdir -p .vercel/output/static vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - rm -rf .vercel/output/static - cp -r build/* .vercel/output/static + rm -rf .vercel/output/static/* + cp -r build/* .vercel/output/static/ - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} From 36eae26f1c06651c3f4fee268e416f4529b34eb7 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 11:32:11 +0800 Subject: [PATCH 27/42] build: add .vercel to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3bf8a11ff..624101c03 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ yarn-error.log* .idea -.vscode/settings.json \ No newline at end of file +.vscode/settings.json +.vercel From 40c58253825905e650381f26110fdb1f041bc209 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 11:33:18 +0800 Subject: [PATCH 28/42] build: override vercel build and change the output dir --- vercel.json | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/vercel.json b/vercel.json index 84c68ef7b..488a7da2d 100644 --- a/vercel.json +++ b/vercel.json @@ -1,14 +1,5 @@ { "cleanUrls": true, - "version": 2, - "builds": [ - { - "src": "package.json", - "use": "@vercel/static-build", - "config": { - "distDir": "build" - } - } - ], - "outputDirectory": ".vercel/output" + "outputDirectory": "build", + "buildCommand": "echo ✅ Skipping build to use existing built files" } \ No newline at end of file From a3b62a0f19a42b7dd8e4abd1e7839cf60fcb8cef Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 12:12:55 +0800 Subject: [PATCH 29/42] chore: to test the deployment --- src/features/Home/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/features/Home/index.tsx b/src/features/Home/index.tsx index 5da905ac0..75edb8064 100644 --- a/src/features/Home/index.tsx +++ b/src/features/Home/index.tsx @@ -11,6 +11,7 @@ import { GetStarted } from './GetStarted/GetStarted'; import RenderOfficialContents from '@site/src/components/RenderOfficialContents'; export default function HomepageFeatures() { + alert('HomepageFeatures'); return (
From da0ef24cd93ed3a2cf94e5355740eb5f1cf74982 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 12:47:43 +0800 Subject: [PATCH 30/42] chore: change alert to console --- src/features/Home/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/Home/index.tsx b/src/features/Home/index.tsx index 75edb8064..00b3aca16 100644 --- a/src/features/Home/index.tsx +++ b/src/features/Home/index.tsx @@ -11,7 +11,7 @@ import { GetStarted } from './GetStarted/GetStarted'; import RenderOfficialContents from '@site/src/components/RenderOfficialContents'; export default function HomepageFeatures() { - alert('HomepageFeatures'); + console.log('HomepageFeatures'); return (
From 3495cdc45f8d659d66a41f933ac7a99d0e1d21b3 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 12:48:14 +0800 Subject: [PATCH 31/42] fix: remove extra step to copy the files --- .github/actions/deploy-to-vercel/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 39d465d3e..49de0afde 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -30,8 +30,6 @@ runs: run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - rm -rf .vercel/output/static/* - cp -r build/* .vercel/output/static/ - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -52,5 +50,5 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" + url="$(vercel deploy --prod --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" vercel alias "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv From 7c75f2b2e90b50423a5d29d70729706fdee03919 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 12:59:45 +0800 Subject: [PATCH 32/42] ci: add preview env to staging step --- .github/actions/deploy-to-vercel/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 49de0afde..a7f1767f2 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -39,7 +39,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" + url="$(vercel deploy --environment=preview --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" vercel alias "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Production) From 7d531e31322dfa917d4ec53ccfd891a39f234dd6 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 13:05:04 +0800 Subject: [PATCH 33/42] ci: remove unknown environment flag --- .github/actions/deploy-to-vercel/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index a7f1767f2..49de0afde 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -39,7 +39,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | - url="$(vercel deploy --environment=preview --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" + url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" vercel alias "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Production) From 8425a3f6920e9bab58959d19d36d8e5e8f830029 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 13:10:04 +0800 Subject: [PATCH 34/42] ci: test prod workflow --- .github/workflows/vercel-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml index dd622a314..364b1ff47 100644 --- a/.github/workflows/vercel-test.yml +++ b/.github/workflows/vercel-test.yml @@ -35,4 +35,4 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} - ENVIRONMENT: Staging + ENVIRONMENT: Production From 0ae8ce74002be4818ffa250e0845d19486df1428 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 13:16:32 +0800 Subject: [PATCH 35/42] ci: build for envs specifically --- .github/actions/deploy-to-vercel/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml index 49de0afde..5b683deb6 100644 --- a/.github/actions/deploy-to-vercel/action.yml +++ b/.github/actions/deploy-to-vercel/action.yml @@ -21,7 +21,7 @@ runs: run: npm install -g vercel shell: bash - - name: Generate Vercel output + - name: Pull Vercel project env: VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} @@ -29,7 +29,6 @@ runs: shell: bash run: | vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - name: Deploy to Vercel (Staging) if: ${{ inputs.ENVIRONMENT == 'Staging' }} @@ -39,6 +38,7 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | + vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" vercel alias "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv @@ -50,5 +50,6 @@ runs: VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} run: | + vercel build --yes --prod --token=${{ env.VERCEL_TOKEN }} --scope=deriv url="$(vercel deploy --prod --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" vercel alias "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv From 996c5e8eafaa2d3e83ecb65e57bed11d9a1026d5 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 26 Jun 2024 13:27:42 +0800 Subject: [PATCH 36/42] feat: add binary.sx in official domains --- src/utils/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/index.ts b/src/utils/index.ts index 98cdbd187..97bb46b89 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -42,6 +42,8 @@ export const domains = [ 'staging-api.deriv.be', 'staging-api.deriv.me', 'staging-api.deriv.com', + 'api.binary.sx', + 'staging-api.binary.sx', ]; export const getCurrencyObject = (currency: string) => { From 5900a6ab6d4aa9cdd3e09666e71819b9773c57f3 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 9 Jul 2024 15:38:50 +0800 Subject: [PATCH 37/42] build: add DR vercel file --- vercel.dr.json | 5 +++++ vercel.json | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 vercel.dr.json diff --git a/vercel.dr.json b/vercel.dr.json new file mode 100644 index 000000000..488a7da2d --- /dev/null +++ b/vercel.dr.json @@ -0,0 +1,5 @@ +{ + "cleanUrls": true, + "outputDirectory": "build", + "buildCommand": "echo ✅ Skipping build to use existing built files" +} \ No newline at end of file diff --git a/vercel.json b/vercel.json index 488a7da2d..a19e4f377 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,3 @@ { - "cleanUrls": true, - "outputDirectory": "build", - "buildCommand": "echo ✅ Skipping build to use existing built files" + "cleanUrls": true } \ No newline at end of file From 4317a95c294b1444ee767df8d7a0d28659662862 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 9 Jul 2024 15:40:17 +0800 Subject: [PATCH 38/42] chore: test the DR in sample a workflow --- .github/actions/deploy-to-vercel/action.yml | 55 --------------------- .github/workflows/vercel-test.yml | 5 +- 2 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 .github/actions/deploy-to-vercel/action.yml diff --git a/.github/actions/deploy-to-vercel/action.yml b/.github/actions/deploy-to-vercel/action.yml deleted file mode 100644 index 5b683deb6..000000000 --- a/.github/actions/deploy-to-vercel/action.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Deploy to Vercel -description: Deploy to Vercel -inputs: - VERCEL_ORG_ID: - description: Vercel organization ID - required: true - VERCEL_PROJECT_ID: - description: Vercel project ID - required: true - VERCEL_TOKEN: - description: Vercel token - required: true - ENVIRONMENT: - description: Environment - required: true - -runs: - using: composite - steps: - - name: Install Vercel CLI - run: npm install -g vercel - shell: bash - - - name: Pull Vercel project - env: - VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} - VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} - shell: bash - run: | - vercel pull --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - - - name: Deploy to Vercel (Staging) - if: ${{ inputs.ENVIRONMENT == 'Staging' }} - shell: bash - env: - VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} - VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} - run: | - vercel build --yes --token=${{ env.VERCEL_TOKEN }} --scope=deriv - url="$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" - vercel alias "$url" staging-api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv - - - name: Deploy to Vercel (Production) - if: ${{ inputs.ENVIRONMENT == 'Production' }} - shell: bash - env: - VERCEL_ORG_ID: ${{ inputs.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ inputs.VERCEL_PROJECT_ID }} - VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }} - run: | - vercel build --yes --prod --token=${{ env.VERCEL_TOKEN }} --scope=deriv - url="$(vercel deploy --prod --prebuilt --token=${{ env.VERCEL_TOKEN }} --scope=deriv)" - vercel alias "$url" api.binary.sx --token=${{ env.VERCEL_TOKEN }} --scope=deriv diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml index 364b1ff47..188981031 100644 --- a/.github/workflows/vercel-test.yml +++ b/.github/workflows/vercel-test.yml @@ -30,9 +30,10 @@ jobs: RELEASE_TAG: ${{ github.ref_name }} RELEASE_TYPE: ${{ env.RELEASE_TYPE }} - name: Upload to vercel - uses: ./.github/actions/deploy-to-vercel + uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' with: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} - ENVIRONMENT: Production + ENVIRONMENT: Preview + VERCEL_SCOPE: deriv From 9f97f3c6fe51987a08ace17c7230880c4dc55ba2 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 9 Jul 2024 15:41:11 +0800 Subject: [PATCH 39/42] ci: add vercel workflow for DR --- .github/workflows/release_production.yml | 8 ++++++++ .github/workflows/release_staging.yml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index a56ff17dd..651f8a43b 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -107,3 +107,11 @@ jobs: with: RELEASE_TYPE: ${{ env.RELEASE_TYPE }} MESSAGE: "'${{ env.RELEASE_TYPE }}' Release succeeded for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *" + - name: Upload to vercel + uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' + with: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} + ENVIRONMENT: Production + VERCEL_SCOPE: deriv diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index f5e782c1c..3d9701ff1 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -50,3 +50,11 @@ jobs: SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} KUBE_SERVER: ${{ secrets.KUBE_SERVER }} DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} + - name: Upload to vercel + uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' + with: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} + ENVIRONMENT: Preview + VERCEL_SCOPE: deriv From bf7292b85b5f06057911e55bca135401d137806e Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 9 Jul 2024 15:49:29 +0800 Subject: [PATCH 40/42] ci: add alias domain url --- .github/workflows/release_production.yml | 1 + .github/workflows/release_staging.yml | 1 + .github/workflows/vercel-test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index 651f8a43b..dc4260302 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -115,3 +115,4 @@ jobs: VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} ENVIRONMENT: Production VERCEL_SCOPE: deriv + ALIAS_DOMAIN_URL: 'api-docs-dr.binary.sx' diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 3d9701ff1..8d7b90a6e 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -58,3 +58,4 @@ jobs: VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} ENVIRONMENT: Preview VERCEL_SCOPE: deriv + ALIAS_DOMAIN_URL: 'staging-api-docs-dr.binary.sx' diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml index 188981031..43a52e51e 100644 --- a/.github/workflows/vercel-test.yml +++ b/.github/workflows/vercel-test.yml @@ -37,3 +37,4 @@ jobs: VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} ENVIRONMENT: Preview VERCEL_SCOPE: deriv + ALIAS_DOMAIN_URL: 'staging-api-docs-dr.binary.sx' From e33c412e02e2d8d3e91d388af9af9bd1d27ff677 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 23 Jul 2024 18:33:36 +0800 Subject: [PATCH 41/42] ci: remove the docker / k8s DR and fix the slack message --- .github/workflows/release_production.yml | 32 ++++++------------------ 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index dc4260302..b18307062 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -82,33 +82,9 @@ jobs: with: name: build path: build - - name: Publish to Docker - id: publish_to_docker - uses: ./.github/actions/publish_to_docker - with: - DOCKER_LATEST_IMAGE_TAG: 'latest' - DOCKER_IMAGE_TAG: ${{ github.ref_name }} - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy to Kubernetes - id: deploy_to_kubernetes - uses: ./.github/actions/deploy_to_kubernetes - with: - K8S_VERSION: ${{ github.ref_name }} - K8S_NAMESPACE: 'deriv-com-api-production' - CA_CRT: ${{ secrets.CA_CRT }} - SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} - KUBE_SERVER: ${{ secrets.KUBE_SERVER }} - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} - - name: Send Slack Notification - if: ${{ steps.publish_to_docker.outcome != 'success' || steps.deploy_to_kubernetes.outcome != 'success' }} - uses: ./.github/actions/notify_slack - with: - RELEASE_TYPE: ${{ env.RELEASE_TYPE }} - MESSAGE: "'${{ env.RELEASE_TYPE }}' Release succeeded for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *" - name: Upload to vercel uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' + id: publish_to_vercel with: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} @@ -116,3 +92,9 @@ jobs: ENVIRONMENT: Production VERCEL_SCOPE: deriv ALIAS_DOMAIN_URL: 'api-docs-dr.binary.sx' + - name: Send Slack Notification + if: always() && ${{ steps.publish_to_vercel.outcome != 'success'}} + uses: ./.github/actions/notify_slack + with: + RELEASE_TYPE: ${{ env.RELEASE_TYPE }} + MESSAGE: "Publish to vercel failed for '${{ env.RELEASE_TYPE }}' release on api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}" From e57795bf457c5f958c52ef1334005d369bee1497 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 23 Jul 2024 18:41:50 +0800 Subject: [PATCH 42/42] chore: discard unneeded changes --- .github/workflows/vercel-test.yml | 40 ------------------------------- src/features/Home/index.tsx | 1 - 2 files changed, 41 deletions(-) delete mode 100644 .github/workflows/vercel-test.yml diff --git a/.github/workflows/vercel-test.yml b/.github/workflows/vercel-test.yml deleted file mode 100644 index 43a52e51e..000000000 --- a/.github/workflows/vercel-test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Deriv Api Docs Vercel Workflow -on: - pull_request: - branches: - - master -env: - RELEASE_TYPE: Production -jobs: - build_and_publish: - name: Builds and Publishes to Vercel - environment: Staging - runs-on: ubuntu-latest - outputs: - RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Setup Node - uses: ./.github/actions/setup_node - - name: Install dependencies - uses: ./.github/actions/npm_install_from_cache - - name: Build - uses: ./.github/actions/build - with: - NODE_ENV: production - TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }} - - name: Versioning - uses: ./.github/actions/versioning - with: - RELEASE_TAG: ${{ github.ref_name }} - RELEASE_TYPE: ${{ env.RELEASE_TYPE }} - - name: Upload to vercel - uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' - with: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} - ENVIRONMENT: Preview - VERCEL_SCOPE: deriv - ALIAS_DOMAIN_URL: 'staging-api-docs-dr.binary.sx' diff --git a/src/features/Home/index.tsx b/src/features/Home/index.tsx index 00b3aca16..5da905ac0 100644 --- a/src/features/Home/index.tsx +++ b/src/features/Home/index.tsx @@ -11,7 +11,6 @@ import { GetStarted } from './GetStarted/GetStarted'; import RenderOfficialContents from '@site/src/components/RenderOfficialContents'; export default function HomepageFeatures() { - console.log('HomepageFeatures'); return (