From 4008b037980c41125d58f3f00108cb381d54f29a Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 16:48:29 +0800 Subject: [PATCH 01/43] fix: added yml script --- .circleci/config.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1659eed75..3fb778ea5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,6 +151,62 @@ commands: echo "New website - http://cf-pages-binary-bot.binary.com" jobs: + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + +
+ Click here to copy & paste above information. + + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ + - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 test: docker: - image: cimg/node:12.18 From 3171ff6f43b39108a480572f475fd11553f10d6f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 16:57:04 +0800 Subject: [PATCH 02/43] fix: added yml script --- .circleci/config.yml | 56 -------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fb778ea5..1659eed75 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,62 +151,6 @@ commands: echo "New website - http://cf-pages-binary-bot.binary.com" jobs: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL - id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - -
- Click here to copy & paste above information. - - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 test: docker: - image: cimg/node:12.18 From e53be67ef62deac85062193208f8d6825b0e7025 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:15:48 +0800 Subject: [PATCH 03/43] fix: script --- .circleci/config.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1659eed75..12e7ab00f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,6 +151,58 @@ commands: echo "New website - http://cf-pages-binary-bot.binary.com" jobs: + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` +
+ Click here to copy & paste above information. + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 test: docker: - image: cimg/node:12.18 From 10b1f6b8864a4911525ee754776948ca0882b9a8 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:20:21 +0800 Subject: [PATCH 04/43] fix: script --- .circleci/config.yml | 234 +++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12e7ab00f..1753ada45 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,123 +150,6 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" -jobs: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL - id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` -
- Click here to copy & paste above information. - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 - test: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - release_staging: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push - - deploy: - target_branch: "staging" - - k8s_deploy - - notify_slack - release_production: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push: - docker_latest_image_tag: latest - docker_image_tag: ${CIRCLE_TAG} - - deploy: - target_branch: "production" - - k8s_deploy: - target: "production" - k8s_namespace: "bot-binary-com-production" - k8s_version: ${CIRCLE_TAG} - - notify_slack - - publish_cloudflare_staging: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_staging - - publish_cloudflare_production: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_production - workflows: test: jobs: @@ -304,3 +187,120 @@ workflows: tags: only: /^production.*/ context: binary-frontend-artifact-upload + ghactions: + jobs: + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` +
+ Click here to copy & paste above information. + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 + test: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + + release_staging: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push + - deploy: + target_branch: "staging" + - k8s_deploy + - notify_slack + release_production: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push: + docker_latest_image_tag: latest + docker_image_tag: ${CIRCLE_TAG} + - deploy: + target_branch: "production" + - k8s_deploy: + target: "production" + k8s_namespace: "bot-binary-com-production" + k8s_version: ${CIRCLE_TAG} + - notify_slack + + publish_cloudflare_staging: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_staging + + publish_cloudflare_production: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_production From 20e1655e3339477435f8c076b0ea9415f220d143 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:26:35 +0800 Subject: [PATCH 05/43] fix: script --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1753ada45..d03437051 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -188,7 +188,8 @@ workflows: only: /^production.*/ context: binary-frontend-artifact-upload ghactions: - jobs: + bot: + jobs: generate_app_id: timeout-minutes: 5 runs-on: ubuntu-latest From ee00f2409c3a1cbc2f70d0876a84fe474941be40 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:27:34 +0800 Subject: [PATCH 06/43] fix: script --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d03437051..1753ada45 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -188,8 +188,7 @@ workflows: only: /^production.*/ context: binary-frontend-artifact-upload ghactions: - bot: - jobs: + jobs: generate_app_id: timeout-minutes: 5 runs-on: ubuntu-latest From 34ea2bbb279fca022abaa34e06e646a6f8584b6b Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:32:51 +0800 Subject: [PATCH 07/43] fix: script --- .circleci/config.yml | 291 ++++++++++++++++++++++++++----------------- 1 file changed, 174 insertions(+), 117 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1753ada45..bae964b9d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -129,8 +129,7 @@ commands: include_project_field: false failure_message: "Release failed for binary bot with version *$(cat www/version)*" success_message: "Release succeeded for binary bot with version *$(cat www/version)*" - webhook: ${SLACK_WEBHOOK} - + webhook: ${SLACK_WEBHOOK} publish_to_pages_staging: description: "Publish to cloudflare pages" @@ -150,6 +149,127 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" +jobs: + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + +
+ Click here to copy & paste above information. + + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ + - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 + test: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + + release_staging: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push + - deploy: + target_branch: "staging" + - k8s_deploy + - notify_slack + release_production: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push: + docker_latest_image_tag: latest + docker_image_tag: ${CIRCLE_TAG} + - deploy: + target_branch: "production" + - k8s_deploy: + target: "production" + k8s_namespace: "bot-binary-com-production" + k8s_version: ${CIRCLE_TAG} + - notify_slack + + publish_cloudflare_staging: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_staging + + publish_cloudflare_production: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_production + workflows: test: jobs: @@ -189,118 +309,55 @@ workflows: context: binary-frontend-artifact-upload ghactions: jobs: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL - id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` -
- Click here to copy & paste above information. - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 - test: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - release_staging: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push - - deploy: - target_branch: "staging" - - k8s_deploy - - notify_slack - release_production: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push: - docker_latest_image_tag: latest - docker_image_tag: ${CIRCLE_TAG} - - deploy: - target_branch: "production" - - k8s_deploy: - target: "production" - k8s_namespace: "bot-binary-com-production" - k8s_version: ${CIRCLE_TAG} - - notify_slack - - publish_cloudflare_staging: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_staging - - publish_cloudflare_production: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_production + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` +
+ Click here to copy & paste above information. + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 From 5c2fe1428e7305f3a832cf19c94b378f3c615dd1 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:35:08 +0800 Subject: [PATCH 08/43] fix: script --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bae964b9d..4ed120fdf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -319,9 +319,9 @@ workflows: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL + - name: Generate Binary Bot ID for deployment Preview URL id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 + uses: binary-com/binary-bot-id-action@v1 with: DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} @@ -334,7 +334,7 @@ workflows: uses: marocchino/sticky-pull-request-comment@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action + header: binary-bot-id-action number: ${{github.event.issue.number}} message: | A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) From 593f99e5aef0fa0760ca527e59145c8c16bf8431 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:40:51 +0800 Subject: [PATCH 09/43] fix: script --- .circleci/config.yml | 56 +------------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ed120fdf..fafe68fea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -306,58 +306,4 @@ workflows: ignore: /.*/ tags: only: /^production.*/ - context: binary-frontend-artifact-upload - ghactions: - jobs: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Binary Bot ID for deployment Preview URL - id: generate_app_id - uses: binary-com/binary-bot-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: binary-bot-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` -
- Click here to copy & paste above information. - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 + context: binary-frontend-artifact-upload \ No newline at end of file From 18efd6173b4739fba57e91712679589f75e5a756 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:41:59 +0800 Subject: [PATCH 10/43] fix: script --- .circleci/config.yml | 121 ------------------------------------------- 1 file changed, 121 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fafe68fea..f9deb6121 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -149,127 +149,6 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" -jobs: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL - id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - -
- Click here to copy & paste above information. - - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 - test: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - release_staging: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push - - deploy: - target_branch: "staging" - - k8s_deploy - - notify_slack - release_production: - docker: - - image: cimg/node:12.18 - steps: - - git_checkout_from_cache - - npm_install - - test - - build - - persist_to_workspace: - root: www - paths: - - . - - docker_build_push: - docker_latest_image_tag: latest - docker_image_tag: ${CIRCLE_TAG} - - deploy: - target_branch: "production" - - k8s_deploy: - target: "production" - k8s_namespace: "bot-binary-com-production" - k8s_version: ${CIRCLE_TAG} - - notify_slack - - publish_cloudflare_staging: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_staging - - publish_cloudflare_production: - docker: - - image: circleci/node:16.13.1-stretch - steps: - - attach_workspace: - at: www - - publish_to_pages_production - workflows: test: jobs: From 8d71548bfdad67448845ac9c8cc0f1388830a37e Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:43:16 +0800 Subject: [PATCH 11/43] fix: script --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f9deb6121..1ebd69172 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -129,7 +129,8 @@ commands: include_project_field: false failure_message: "Release failed for binary bot with version *$(cat www/version)*" success_message: "Release succeeded for binary bot with version *$(cat www/version)*" - webhook: ${SLACK_WEBHOOK} + webhook: ${SLACK_WEBHOOK} + publish_to_pages_staging: description: "Publish to cloudflare pages" From d1948d89542c818eda8f8f4d5037e3bf7aa07508 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:44:13 +0800 Subject: [PATCH 12/43] fix: script --- .circleci/config.yml | 67 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ebd69172..1659eed75 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,6 +150,71 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" +jobs: + test: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + + release_staging: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push + - deploy: + target_branch: "staging" + - k8s_deploy + - notify_slack + release_production: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push: + docker_latest_image_tag: latest + docker_image_tag: ${CIRCLE_TAG} + - deploy: + target_branch: "production" + - k8s_deploy: + target: "production" + k8s_namespace: "bot-binary-com-production" + k8s_version: ${CIRCLE_TAG} + - notify_slack + + publish_cloudflare_staging: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_staging + + publish_cloudflare_production: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_production + workflows: test: jobs: @@ -186,4 +251,4 @@ workflows: ignore: /.*/ tags: only: /^production.*/ - context: binary-frontend-artifact-upload \ No newline at end of file + context: binary-frontend-artifact-upload From 141b99b3b3221c28b02b382b5adfe412bcb7f4ce Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:48:25 +0800 Subject: [PATCH 13/43] fix: script --- .circleci/config.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1659eed75..575d64565 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -208,6 +208,65 @@ jobs: - publish_to_pages_staging publish_cloudflare_production: + + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - name: Generate Deriv App ID for deployment Preview URL + id: generate_app_id + uses: binary-com/deriv-app-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) + + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + +
+ Click here to copy & paste above information. + + ``` + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` + ``` +
+ + - name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 + + docker: - image: circleci/node:16.13.1-stretch steps: From e1ae08c94056416152785b56a670375794c74b9e Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:51:55 +0800 Subject: [PATCH 14/43] fix: script --- .circleci/config.yml | 65 +++++--------------------------------------- 1 file changed, 7 insertions(+), 58 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 575d64565..a46ff837d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,13 @@ commands: git_checkout_from_cache: description: "Git checkout and save cache" steps: + - gh-actions: + name: Git restore cache + keys: + - source-v1-{{ .Branch }}-{{ .Revision }} + - source-v1-{{ .Branch }}- + - source-v1- + - restore_cache: name: Git restore cache keys: @@ -209,64 +216,6 @@ jobs: publish_cloudflare_production: - generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - name: Generate Deriv App ID for deployment Preview URL - id: generate_app_id - uses: binary-com/deriv-app-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})) - - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - -
- Click here to copy & paste above information. - - ``` - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` - ``` -
- - - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 - - docker: - image: circleci/node:16.13.1-stretch steps: From 29a67d0d49b7d3b6ce4f27916a7852e242df912e Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:54:42 +0800 Subject: [PATCH 15/43] fix: script --- .circleci/config.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a46ff837d..4d70bf387 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,13 +6,6 @@ commands: git_checkout_from_cache: description: "Git checkout and save cache" steps: - - gh-actions: - name: Git restore cache - keys: - - source-v1-{{ .Branch }}-{{ .Revision }} - - source-v1-{{ .Branch }}- - - source-v1- - - restore_cache: name: Git restore cache keys: @@ -157,6 +150,15 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" + gh-actions: + description: "Publish to cloudflare pages" + steps: + - run: + name: "Publish to cloudflare pages (production)" + command: | + npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main + echo "New website - http://cf-pages-binary-bot.binary.com" + jobs: test: docker: From 635310c282831c9f026b01e6f7ee8fae31f44d60 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:55:12 +0800 Subject: [PATCH 16/43] fix: script 12 --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d70bf387..9b203f1b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,6 +150,7 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" + gh-actions: description: "Publish to cloudflare pages" steps: From 053d58a73fc0ebe1e544b95c49516119d9d4c161 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 17:58:59 +0800 Subject: [PATCH 17/43] fix: script 12 --- .circleci/config.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b203f1b4..e6e139d04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -152,13 +152,16 @@ commands: gh-actions: - description: "Publish to cloudflare pages" - steps: - - run: - name: "Publish to cloudflare pages (production)" - command: | - npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main - echo "New website - http://cf-pages-binary-bot.binary.com" + description: "Publish to cloudflare pages" + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) jobs: test: From dc96787b49f0014046984c4917083c90ef975bbd Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:00:01 +0800 Subject: [PATCH 18/43] fix: script 12 --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6e139d04..b497f5adf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -153,8 +153,6 @@ commands: gh-actions: description: "Publish to cloudflare pages" - timeout-minutes: 5 - runs-on: ubuntu-latest steps: - name: Capture Vercel preview URL id: vercel_preview_url From aac2555323ecc62a6970bab345aa5604f6ffd583 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:01:14 +0800 Subject: [PATCH 19/43] fix: script 12 --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b497f5adf..462359c77 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -154,7 +154,8 @@ commands: gh-actions: description: "Publish to cloudflare pages" steps: - - name: Capture Vercel preview URL + - run: + name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 with: From f7e89d434e905e45c323de7f60551b5df5ee10b5 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:05:38 +0800 Subject: [PATCH 20/43] fix: script 14 --- .circleci/config.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 462359c77..24832cf65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,18 +151,28 @@ commands: echo "New website - http://cf-pages-binary-bot.binary.com" - gh-actions: - description: "Publish to cloudflare pages" + # gh-actions: + # description: "Publish to cloudflare pages" + # steps: + # - run: + # name: Capture Vercel preview URL + # id: vercel_preview_url + # uses: binary-com/vercel-preview-url-action@v1.0.5 + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + +jobs: + generate_app_id: + timeout-minutes: 5 + runs-on: ubuntu-latest steps: - - run: - name: Capture Vercel preview URL + - name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - -jobs: test: docker: - image: cimg/node:12.18 From cd2ac8822c8d3da5ce4c2c62a4489afcea25dbc1 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:07:01 +0800 Subject: [PATCH 21/43] fix: script 16 --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 24832cf65..13e9b546f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -164,8 +164,6 @@ commands: jobs: generate_app_id: - timeout-minutes: 5 - runs-on: ubuntu-latest steps: - name: Capture Vercel preview URL id: vercel_preview_url From 02a528308a36ae61ca057b3f5c0a485755d6881a Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:14:34 +0800 Subject: [PATCH 22/43] fix: script 16 --- .circleci/config.yml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 13e9b546f..fde78b248 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,6 +48,7 @@ commands: key: npm-v1-{{ checksum "package.json" }} paths: - "node_modules" + build: description: "Build" steps: @@ -163,14 +164,23 @@ commands: # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) jobs: - generate_app_id: - steps: - - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + # generate_app_id: + # steps: + # - name: Capture Vercel preview URL + # id: vercel_preview_url + # uses: binary-com/vercel-preview-url-action@v1.0.5 + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + ghactions: + docker: + - image: cimg/: + auth: + username: mydockerhub-user + password: $DOCKERHUB_PASSWORD # context / project UI env-var reference + steps: + - checkout + - run: echo "this is the build job" test: docker: - image: cimg/node:12.18 @@ -237,6 +247,9 @@ jobs: - publish_to_pages_production workflows: + build_and_test: + jobs: + - ghactions test: jobs: - test: From e62b66a4737e7b6beb6ffe8e46d2dfbf7c8ffee1 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:20:40 +0800 Subject: [PATCH 23/43] gh actions 16 --- .circleci/config.yml | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fde78b248..fff6b99d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,17 @@ orbs: k8s: circleci/kubernetes@0.7.0 slack: circleci/slack@3.4.2 commands: + git_gh_actions: + description: "Capture Vercel preview URL" + steps: + - step1: + name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + git_checkout_from_cache: description: "Git checkout and save cache" steps: @@ -164,23 +175,6 @@ commands: # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) jobs: - # generate_app_id: - # steps: - # - name: Capture Vercel preview URL - # id: vercel_preview_url - # uses: binary-com/vercel-preview-url-action@v1.0.5 - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - ghactions: - docker: - - image: cimg/: - auth: - username: mydockerhub-user - password: $DOCKERHUB_PASSWORD # context / project UI env-var reference - steps: - - checkout - - run: echo "this is the build job" test: docker: - image: cimg/node:12.18 @@ -247,9 +241,6 @@ jobs: - publish_to_pages_production workflows: - build_and_test: - jobs: - - ghactions test: jobs: - test: From fc58666119ab2d24a162e4a0b1dfa20eccc1af9f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:22:23 +0800 Subject: [PATCH 24/43] gh actions align --- .circleci/config.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fff6b99d6..2e21e32b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,15 +5,14 @@ orbs: commands: git_gh_actions: description: "Capture Vercel preview URL" - steps: - - step1: - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - + steps: + - step1: + name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) git_checkout_from_cache: description: "Git checkout and save cache" steps: From b3d1ae02ee3c28eecf3d53edc5de9536bcb1128c Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:25:53 +0800 Subject: [PATCH 25/43] gh actions 16 step 2 --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e21e32b9..9b3da339e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,16 @@ commands: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - step2: + name: Generate Binary Bot ID for deployment Preview URL + id: generate_app_id + uses: binary-com/binary-bot-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} git_checkout_from_cache: description: "Git checkout and save cache" steps: From 8a05044c434c6d3fb1c6cc92f9d5ffc6bdb97911 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:29:24 +0800 Subject: [PATCH 26/43] gh actions 16 step 3 --- .circleci/config.yml | 53 +++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b3da339e..e17ce2fe0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,24 +5,50 @@ orbs: commands: git_gh_actions: description: "Capture Vercel preview URL" - steps: + steps: - step1: name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - step2: name: Generate Binary Bot ID for deployment Preview URL id: generate_app_id uses: binary-com/binary-bot-id-action@v1 with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - step3: + name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: deriv-app-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} +
+ Click here to copy & paste above information. git_checkout_from_cache: description: "Git checkout and save cache" steps: @@ -68,7 +94,7 @@ commands: key: npm-v1-{{ checksum "package.json" }} paths: - "node_modules" - + build: description: "Build" steps: @@ -150,8 +176,7 @@ commands: include_project_field: false failure_message: "Release failed for binary bot with version *$(cat www/version)*" success_message: "Release succeeded for binary bot with version *$(cat www/version)*" - webhook: ${SLACK_WEBHOOK} - + webhook: ${SLACK_WEBHOOK} publish_to_pages_staging: description: "Publish to cloudflare pages" @@ -171,8 +196,7 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" - - # gh-actions: + # gh-actions: # description: "Publish to cloudflare pages" # steps: # - run: @@ -231,7 +255,7 @@ jobs: k8s_namespace: "bot-binary-com-production" k8s_version: ${CIRCLE_TAG} - notify_slack - + publish_cloudflare_staging: docker: - image: circleci/node:16.13.1-stretch @@ -241,7 +265,6 @@ jobs: - publish_to_pages_staging publish_cloudflare_production: - docker: - image: circleci/node:16.13.1-stretch steps: From 3cd1d1429fd1e457da2aa3cdb1d99417fc9323eb Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:32:18 +0800 Subject: [PATCH 27/43] gh actions 16 step 4 --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e17ce2fe0..ca6a5f58c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,9 @@ commands: - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` ```
+ - step4: + name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt git_checkout_from_cache: description: "Git checkout and save cache" steps: From 3f9017a71f87d5f4c74648f3a4c636a0ff775880 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:35:27 +0800 Subject: [PATCH 28/43] gh actions 16 step 4 --- .circleci/config.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca6a5f58c..7c75a9562 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,6 +52,14 @@ commands: - step4: name: Store generated URL in artifact run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - step5: + name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 + git_checkout_from_cache: description: "Git checkout and save cache" steps: @@ -199,17 +207,6 @@ commands: npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main echo "New website - http://cf-pages-binary-bot.binary.com" - # gh-actions: - # description: "Publish to cloudflare pages" - # steps: - # - run: - # name: Capture Vercel preview URL - # id: vercel_preview_url - # uses: binary-com/vercel-preview-url-action@v1.0.5 - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - jobs: test: docker: From cd3cea4045f15b37bfb712fed83afccac13c90d7 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:42:11 +0800 Subject: [PATCH 29/43] gh actions 16 step 8 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c75a9562..1a77b2e82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ orbs: k8s: circleci/kubernetes@0.7.0 slack: circleci/slack@3.4.2 commands: - git_gh_actions: + generate_app_id: description: "Capture Vercel preview URL" steps: - step1: From 659318927df19935f748730c168217760356dbed Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:47:52 +0800 Subject: [PATCH 30/43] gh actions 16 step 10 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a77b2e82..ef946f3cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,7 +30,7 @@ commands: uses: marocchino/sticky-pull-request-comment@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: deriv-app-id-action + header: binary-bot-id-action number: ${{github.event.issue.number}} message: | A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) From ece47da487aa2aafc1c7f27dee2fb8d89e2fc36e Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 18:53:39 +0800 Subject: [PATCH 31/43] gh actions 16 step 10 --- .github/ghactions.yml | 311 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 .github/ghactions.yml diff --git a/.github/ghactions.yml b/.github/ghactions.yml new file mode 100644 index 000000000..ef946f3cf --- /dev/null +++ b/.github/ghactions.yml @@ -0,0 +1,311 @@ +version: 2.1 +orbs: + k8s: circleci/kubernetes@0.7.0 + slack: circleci/slack@3.4.2 +commands: + generate_app_id: + description: "Capture Vercel preview URL" + steps: + - step1: + name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - step2: + name: Generate Binary Bot ID for deployment Preview URL + id: generate_app_id + uses: binary-com/binary-bot-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - step3: + name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: binary-bot-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} +
+ Click here to copy & paste above information. + - step4: + name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - step5: + name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1 + + git_checkout_from_cache: + description: "Git checkout and save cache" + steps: + - restore_cache: + name: Git restore cache + keys: + - source-v1-{{ .Branch }}-{{ .Revision }} + - source-v1-{{ .Branch }}- + - source-v1- + - run: + name: Fetch git tags + command: | + mkdir -p ~/.ssh + ssh-keygen -F github.com || ssh-keyscan github.com >> ~/.ssh/known_hosts + echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts + # Fetch tags if git cache is present + if [ -e /home/circleci/project/.git ] + then + git fetch origin --tags + fi + - checkout + - run: + name: Compress git objects + command: git gc + - save_cache: + name: Git save cache + key: source-v1-{{ .Branch }}-{{ .Revision }} + paths: + - ".git" + npm_install: + description: "Install npm modules" + steps: + - restore_cache: + name: Restore npm cache + keys: + - npm-v1-{{ checksum "package.json" }} + - npm-v1- + - run: + name: Install npm modules + command: npm install + - save_cache: + name: Save NPM cache + key: npm-v1-{{ checksum "package.json" }} + paths: + - "node_modules" + + build: + description: "Build" + steps: + - run: + name: "Create environment variables file" + command: | + echo GD_CLIENT_ID=${GD_CLIENT_ID} > .env + echo GD_API_KEY=${GD_API_KEY} >> .env + echo GD_APP_ID=${GD_APP_ID} >> .env + echo TRACKJS_TOKEN=${TRACKJS_TOKEN} >> .env + - run: + name: "npm run build" + command: node_modules/gulp/bin/gulp.js build-min + deploy: + description: "Deploy to static branches" + parameters: + target_branch: + type: string + steps: + - checkout + - attach_workspace: + at: www + - run: + name: Tag build + command: echo "<< parameters.target_branch >> $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > www/version + docker_build_push: + description: "Build and Push image to docker hub" + parameters: + docker_latest_image_tag: + type: string + default: "latest-staging" + docker_image_tag: + type: string + default: ${CIRCLE_SHA1} + steps: + - setup_remote_docker + - run: + name: Building docker image for << parameters.docker_latest_image_tag >> + command: | + docker build -t ${DOCKHUB_ORGANISATION}/binary-static-bot:<< parameters.docker_image_tag >> -t ${DOCKHUB_ORGANISATION}/binary-static-bot:<< parameters.docker_latest_image_tag >> . + - run: + name: Pushing Image to docker hub + command: | + echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin + docker push ${DOCKHUB_ORGANISATION}/binary-static-bot + k8s_deploy: + description: "Deploy to k8s cluster" + parameters: + target: + type: string + default: "beta" + k8s_version: + type: string + default: ${CIRCLE_SHA1} + k8s_namespace: + type: string + default: "bot-binary-com-staging" + steps: + - k8s/install-kubectl + - run: + name: Deploying to k8s cluster for service << parameters.k8s_namespace >> + command: | + export NAMESPACE=<< parameters.k8s_namespace >> + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo $CA_CRT | base64 --decode > ca.crt + ./release.sh binary-static-bot << parameters.k8s_version >> + test: + description: "Run test" + steps: + - run: + name: Run tests + command: | + for i in {1..3}; do npm test && break; done + notify_slack: + description: "Notify slack" + steps: + - slack/status: + include_project_field: false + failure_message: "Release failed for binary bot with version *$(cat www/version)*" + success_message: "Release succeeded for binary bot with version *$(cat www/version)*" + webhook: ${SLACK_WEBHOOK} + + publish_to_pages_staging: + description: "Publish to cloudflare pages" + steps: + - run: + name: "Publish to cloudflare pages (staging)" + command: | + npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=staging + echo "New staging website - http://staging.cf-pages-binary-bot.binary.com" + + publish_to_pages_production: + description: "Publish to cloudflare pages" + steps: + - run: + name: "Publish to cloudflare pages (production)" + command: | + npx wrangler pages publish www/ --project-name=binary-bot-pages --branch=main + echo "New website - http://cf-pages-binary-bot.binary.com" + +jobs: + test: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + + release_staging: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push + - deploy: + target_branch: "staging" + - k8s_deploy + - notify_slack + release_production: + docker: + - image: cimg/node:12.18 + steps: + - git_checkout_from_cache + - npm_install + - test + - build + - persist_to_workspace: + root: www + paths: + - . + - docker_build_push: + docker_latest_image_tag: latest + docker_image_tag: ${CIRCLE_TAG} + - deploy: + target_branch: "production" + - k8s_deploy: + target: "production" + k8s_namespace: "bot-binary-com-production" + k8s_version: ${CIRCLE_TAG} + - notify_slack + + publish_cloudflare_staging: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_staging + + publish_cloudflare_production: + docker: + - image: circleci/node:16.13.1-stretch + steps: + - attach_workspace: + at: www + - publish_to_pages_production + +workflows: + test: + jobs: + - test: + filters: + branches: + ignore: /^master$/ + release: + jobs: + - release_staging: + filters: + branches: + only: /^master$/ + context: binary-frontend-artifact-upload + - publish_cloudflare_staging: + requires: + - release_staging + filters: + branches: + only: /^master$/ + context: binary-frontend-artifact-upload + - release_production: + filters: + branches: + ignore: /.*/ + tags: + only: /^production.*/ + context: binary-frontend-artifact-upload + - publish_cloudflare_production: + requires: + - release_production + filters: + branches: + ignore: /.*/ + tags: + only: /^production.*/ + context: binary-frontend-artifact-upload From 5aae5053a7ea9662cb86f67a5c036f793e4c03bc Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 19:01:02 +0800 Subject: [PATCH 32/43] gh actions workflows --- .github/{ => workflows}/ghactions.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/ghactions.yml (100%) diff --git a/.github/ghactions.yml b/.github/workflows/ghactions.yml similarity index 100% rename from .github/ghactions.yml rename to .github/workflows/ghactions.yml From 844a15357da9ad8ec53d18188900dedf63ad9e66 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Thu, 19 Jan 2023 19:18:08 +0800 Subject: [PATCH 33/43] gh actions workflows --- .github/workflows/lighthouse.yml | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/lighthouse.yml diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 000000000..38daa222b --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,71 @@ +name: Vercel Preview URL Lighthouse Audit + +on: + issue_comment: + types: [edited] + +jobs: + generate_lighthouse_audit: + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - name: Add comment to PR + id: loading_comment_to_pr + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} + header: lighthouse + message: | + Running Lighthouse audit... + - name: Capture Vercel preview URL + id: vercel_preview_url + uses: aaron-binary/vercel-preview-url-action@v0.0.3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: Audit preview URL with Lighthouse + id: lighthouse_audit + uses: treosh/lighthouse-ci-action@v3 + with: + urls: | + ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + uploadArtifacts: true + temporaryPublicStorage: true + - name: Format lighthouse score + id: format_lighthouse_score + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary + const links = ${{ steps.lighthouse_audit.outputs.links }} + + const formatResult = (res) => Math.round((res * 100)) + Object.keys(result).forEach(key => result[key] = formatResult(result[key])) + + const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴' + + const comment = [ + `⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`, + '| Category | Score |', + '| --- | --- |', + `| ${score(result.performance)} Performance | ${result.performance} |`, + `| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`, + `| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`, + `| ${score(result.seo)} SEO | ${result.seo} |`, + `| ${score(result.pwa)} PWA | ${result.pwa} |`, + ' ', + `*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*` + ].join('\n') + + core.setOutput("comment", comment); + - name: Add comment to PR + id: comment_to_pr + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} + header: lighthouse + message: | + ${{ steps.format_lighthouse_score.outputs.comment }} \ No newline at end of file From 6d52df1e71134e82e65d471f2ed22dd0dfdac9fa Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 13:32:10 +0800 Subject: [PATCH 34/43] gh actions workflowtrigger --- .github/workflows/ghactions.yml | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index ef946f3cf..3695e86bd 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -279,6 +279,62 @@ workflows: filters: branches: ignore: /^master$/ + generate_app_id: + description: "Capture Vercel preview URL" + steps: + - step1: + name: Capture Vercel preview URL + id: vercel_preview_url + uses: binary-com/vercel-preview-url-action@v1.0.5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - step2: + name: Generate Binary Bot ID for deployment Preview URL + id: generate_app_id + uses: binary-com/binary-bot-id-action@v1 + with: + DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + max_retries: 5 + vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - step3: + name: Comment on pull request with App ID and URLs + id: sticky_comment_on_pr + if: steps.generate_app_id.outputs.should_post_comment + uses: marocchino/sticky-pull-request-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: binary-bot-id-action + number: ${{github.event.issue.number}} + message: | + A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + - **URLs**: + - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} +
+ Click here to copy & paste above information. + - step4: + name: Store generated URL in artifact + run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + - step5: + name: Upload artifact + uses: actions/upload-artifact@master + with: + name: generated_url + path: ${{ github.workspace }}/url.txt + retention-days: 1: release: jobs: - release_staging: From 2f1922abc3687bebfd68795eeda10b898c17678b Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 13:36:19 +0800 Subject: [PATCH 35/43] gh actions workflow 98 --- .github/workflows/ghactions.yml | 60 +-------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index 3695e86bd..eaa79138b 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -3,63 +3,6 @@ orbs: k8s: circleci/kubernetes@0.7.0 slack: circleci/slack@3.4.2 commands: - generate_app_id: - description: "Capture Vercel preview URL" - steps: - - step1: - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - step2: - name: Generate Binary Bot ID for deployment Preview URL - id: generate_app_id - uses: binary-com/binary-bot-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - step3: - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: binary-bot-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} -
- Click here to copy & paste above information. - - step4: - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - step5: - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1 - git_checkout_from_cache: description: "Git checkout and save cache" steps: @@ -280,8 +223,7 @@ workflows: branches: ignore: /^master$/ generate_app_id: - description: "Capture Vercel preview URL" - steps: + jobs: - step1: name: Capture Vercel preview URL id: vercel_preview_url From 0841d52e240eb4452dd33f249cce58cd8f51089f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 13:42:48 +0800 Subject: [PATCH 36/43] gh actions workflow 98 --- .github/workflows/ghactions.yml | 120 ++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index eaa79138b..0e433bb40 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -224,6 +224,7 @@ workflows: ignore: /^master$/ generate_app_id: jobs: + steps: - step1: name: Capture Vercel preview URL id: vercel_preview_url @@ -231,52 +232,79 @@ workflows: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - step2: - name: Generate Binary Bot ID for deployment Preview URL - id: generate_app_id - uses: binary-com/binary-bot-id-action@v1 - with: - DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} - DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - max_retries: 5 - vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - step3: - name: Comment on pull request with App ID and URLs - id: sticky_comment_on_pr - if: steps.generate_app_id.outputs.should_post_comment - uses: marocchino/sticky-pull-request-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: binary-bot-id-action - number: ${{github.event.issue.number}} - message: | - A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) - - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) - - **URLs**: - - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} - - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} -
- Click here to copy & paste above information. - - step4: - name: Store generated URL in artifact - run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - step5: - name: Upload artifact - uses: actions/upload-artifact@master - with: - name: generated_url - path: ${{ github.workspace }}/url.txt - retention-days: 1: + # - run: + # name: Fetch git tags + # command: | + # mkdir -p ~/.ssh + # ssh-keygen -F github.com || ssh-keyscan github.com >> ~/.ssh/known_hosts + # echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts + # # Fetch tags if git cache is present + # if [ -e /home/circleci/project/.git ] + # then + # git fetch origin --tags + # fi + # - checkout + # - run: + # name: Compress git objects + # command: git gc + # - save_cache: + # name: Git save cache + # key: source-v1-{{ .Branch }}-{{ .Revision }} + # paths: + # - ".git" + # - step1: + # name: Capture Vercel preview URL + # id: vercel_preview_url + # uses: binary-com/vercel-preview-url-action@v1.0.5 + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + # - step2: + # name: Generate Binary Bot ID for deployment Preview URL + # id: generate_app_id + # uses: binary-com/binary-bot-id-action@v1 + # with: + # DERIV_API_TOKEN: ${{ secrets.DERIV_API_TOKEN }} + # DERIV_APP_ID: ${{ secrets.DERIV_APP_ID }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # max_retries: 5 + # vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + # - step3: + # name: Comment on pull request with App ID and URLs + # id: sticky_comment_on_pr + # if: steps.generate_app_id.outputs.should_post_comment + # uses: marocchino/sticky-pull-request-comment@v1 + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # header: binary-bot-id-action + # number: ${{github.event.issue.number}} + # message: | + # A production App ID was automatically generated for this PR. ([log](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + # - **PR**: [${{ steps.generate_app_id.outputs.pr_url }}](${{ steps.generate_app_id.outputs.pr_url }}) + # - **URLs**: + # - **w/ App ID + Server**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }} + # - **Original**: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} + # - **App ID**: `${{ steps.generate_app_id.outputs.app_id }} + #
+ # Click here to copy & paste above information. + # - step4: + # name: Store generated URL in artifact + # run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt + # - step5: + # name: Upload artifact + # uses: actions/upload-artifact@master + # with: + # name: generated_url + # path: ${{ github.workspace }}/url.txt + # retention-days: 1: release: jobs: - release_staging: From 2fa6d6c7963d8e6430927439d8a7bd4787df2b83 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 13:43:47 +0800 Subject: [PATCH 37/43] gh actions workflow 98 --- .github/workflows/ghactions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index 0e433bb40..4f78611d0 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -225,7 +225,7 @@ workflows: generate_app_id: jobs: steps: - - step1: + - run: name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 From bd09c0815eeda97a7fd2c0200bfbfb0f876db5d2 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 13:56:37 +0800 Subject: [PATCH 38/43] gh actions workflow 98 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef946f3cf..b6286bde7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,14 +6,14 @@ commands: generate_app_id: description: "Capture Vercel preview URL" steps: - - step1: + - run: name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - step2: + - run: name: Generate Binary Bot ID for deployment Preview URL id: generate_app_id uses: binary-com/binary-bot-id-action@v1 @@ -23,7 +23,7 @@ commands: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} max_retries: 5 vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - step3: + - run: name: Comment on pull request with App ID and URLs id: sticky_comment_on_pr if: steps.generate_app_id.outputs.should_post_comment @@ -49,10 +49,10 @@ commands: - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` ```
- - step4: + - run: name: Store generated URL in artifact run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - step5: + - run: name: Upload artifact uses: actions/upload-artifact@master with: From 566d81301e444b2173dce7f65dd04220c52af911 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 14:04:19 +0800 Subject: [PATCH 39/43] gh actions workflow 98 --- .github/workflows/ghactions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index 4f78611d0..b3462b85d 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -6,7 +6,7 @@ commands: git_checkout_from_cache: description: "Git checkout and save cache" steps: - - restore_cache: + - run: name: Git restore cache keys: - source-v1-{{ .Branch }}-{{ .Revision }} From 4d5d8d37f740549c4b1806852ed1eddef9fead40 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 14:06:47 +0800 Subject: [PATCH 40/43] gh actions workflow 98 --- .github/workflows/ghactions.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index b3462b85d..526d3711d 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -225,13 +225,11 @@ workflows: generate_app_id: jobs: steps: - - run: - name: Capture Vercel preview URL - id: vercel_preview_url - uses: binary-com/vercel-preview-url-action@v1.0.5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) + - restore_cache: + name: Restore npm cache + keys: + - npm-v1-{{ checksum "package.json" }} + - npm-v1- # - run: # name: Fetch git tags # command: | From 06e16b5a0c74a690b07f354661ef2cf7c6ac3540 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 20 Jan 2023 14:10:52 +0800 Subject: [PATCH 41/43] gh actions workflow 980 --- .github/workflows/ghactions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index 526d3711d..0868554cf 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -225,7 +225,7 @@ workflows: generate_app_id: jobs: steps: - - restore_cache: + - run: name: Restore npm cache keys: - npm-v1-{{ checksum "package.json" }} From ce896422b4daa747c95b215da7b0c12027084d45 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Wed, 25 Jan 2023 11:24:20 +0800 Subject: [PATCH 42/43] fix: circle CI --- .circleci/config.yml | 2 +- .github/workflows/ghactions.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6286bde7..7db6e1631 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -308,4 +308,4 @@ workflows: ignore: /.*/ tags: only: /^production.*/ - context: binary-frontend-artifact-upload + context: binary-frontend-artifact-upload \ No newline at end of file diff --git a/.github/workflows/ghactions.yml b/.github/workflows/ghactions.yml index 0868554cf..85812c2f3 100644 --- a/.github/workflows/ghactions.yml +++ b/.github/workflows/ghactions.yml @@ -332,4 +332,4 @@ workflows: ignore: /.*/ tags: only: /^production.*/ - context: binary-frontend-artifact-upload + context: binary-frontend-artifact-upload \ No newline at end of file From 824d96b61282e2860a33afd22cedaeada0451edd Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Fri, 27 Jan 2023 14:21:58 +0800 Subject: [PATCH 43/43] fix: removed run keyword --- .circleci/config.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7db6e1631..c4b465540 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,15 +6,13 @@ commands: generate_app_id: description: "Capture Vercel preview URL" steps: - - run: - name: Capture Vercel preview URL + - name: Capture Vercel preview URL id: vercel_preview_url uses: binary-com/vercel-preview-url-action@v1.0.5 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} preview_url_regexp: \[Visit Preview\]\((.*?.sx)\) - - run: - name: Generate Binary Bot ID for deployment Preview URL + - name: Generate Binary Bot ID for deployment Preview URL id: generate_app_id uses: binary-com/binary-bot-id-action@v1 with: @@ -23,8 +21,7 @@ commands: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} max_retries: 5 vercel_preview_url: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }} - - run: - name: Comment on pull request with App ID and URLs + - name: Comment on pull request with App ID and URLs id: sticky_comment_on_pr if: steps.generate_app_id.outputs.should_post_comment uses: marocchino/sticky-pull-request-comment@v1 @@ -49,11 +46,9 @@ commands: - **App ID**: `${{ steps.generate_app_id.outputs.app_id }}` ```
- - run: - name: Store generated URL in artifact + - name: Store generated URL in artifact run: echo "HOME_URL=${{ steps.vercel_preview_url.outputs.vercel_preview_url }}?qa_server=frontend.binaryws.com&app_id=${{ steps.generate_app_id.outputs.app_id }}" >> ${{ github.workspace }}/url.txt - - run: - name: Upload artifact + - name: Upload artifact uses: actions/upload-artifact@master with: name: generated_url