diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 28fb7dc5b78..ab380000f3f 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -23,7 +23,7 @@ env: GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }} GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }} GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }} - + jobs: release-beta: timeout-minutes: 30 @@ -39,6 +39,14 @@ jobs: node-version: '18.x' cache: 'npm' + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc + - run: npm ci # - run: npm run format # - run: npm run test diff --git a/.github/workflows/corewebvitals.yml b/.github/workflows/corewebvitals.yml index dba5e214fa1..ac2e9f21b2c 100644 --- a/.github/workflows/corewebvitals.yml +++ b/.github/workflows/corewebvitals.yml @@ -1,111 +1,118 @@ name: Core Web Vitals Audit permissions: - actions: write - checks: write - contents: write - deployments: write - pull-requests: write - statuses: write + actions: write + checks: write + contents: write + deployments: write + pull-requests: write + statuses: write on: - push: - branches: - - main - pull_request: - branches: - - main + push: + branches: + - main + pull_request: + branches: + - main jobs: - core_web_vitals_audit: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 + core_web_vitals_audit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: 18 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc - - name: Install dependencies - run: npm ci + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc - - name: Run Core Web Vitals Audit - run: npm run audit + - name: Install dependencies + run: npm ci - - name: Install Datadog CI - run: npm install -g @datadog/datadog-ci + - name: Run Core Web Vitals Audit + run: npm run audit - - name: Sync results with Datadog - run: | - datadog-ci synthetics upload --config datadog-ci.json - datadog-ci synthetics results --config datadog-ci.json > results.json - env: - DATADOG_API_KEY: ${{ secrets.GATSBY_DATADOG_CLIENT_TOKEN }} - DATADOG_APP_KEY: ${{ secrets.GATSBY_DATADOG_APPLICATION_ID }} - - - name: Post audit comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: Core Web Vitals Audit - message: | - ### Core Web Vitals Results - - Largest Contentful Paint: ${{ steps.results.outputs.lcp }} - - First Input Delay: ${{ steps.results.outputs.fid }} - - Cumulative Layout Shift: ${{ steps.results.outputs.cls }} - - - name: Slack Notification 📣 - uses: 8398a7/action-slack@v3 - if: ${{ failure() }} - with: - status: custom - fields: workflow,job,commit,repo - custom_payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "plain_text", - "emoji": true, - "text": "It appears that this pull request has not met the required Core Web Vitals score." - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*User: <${{ github.event.pull_request.user.url }}|${{ github.event.pull_request.user.login }}>*\n*Link:* ${{ github.event.pull_request.html_url }}\n*Title:* ${{ github.event.pull_request.title }}\n*Status:* ${{ github.event.pull_request.state }}" - }, - "accessory": { - "type": "image", - "image_url": "${{ github.event.pull_request.user.avatar_url }}", - "alt_text": "${{ github.event.pull_request.user.login }}" - } - }, - { - "type": "divider" - }, - { - "type": "context", - "elements": [ - { - "type": "image", - "image_url": "https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", - "alt_text": "notifications warning icon" - }, - { - "type": "mrkdwn", - "text": "* please check the PR*" - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Install Datadog CI + run: npm install -g @datadog/datadog-ci + + - name: Sync results with Datadog + run: | + datadog-ci synthetics upload --config datadog-ci.json + datadog-ci synthetics results --config datadog-ci.json > results.json + env: + DATADOG_API_KEY: ${{ secrets.GATSBY_DATADOG_CLIENT_TOKEN }} + DATADOG_APP_KEY: ${{ secrets.GATSBY_DATADOG_APPLICATION_ID }} + + - name: Post audit comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: Core Web Vitals Audit + message: | + ### Core Web Vitals Results + - Largest Contentful Paint: ${{ steps.results.outputs.lcp }} + - First Input Delay: ${{ steps.results.outputs.fid }} + - Cumulative Layout Shift: ${{ steps.results.outputs.cls }} + + - name: Slack Notification 📣 + uses: 8398a7/action-slack@v3 + if: ${{ failure() }} + with: + status: custom + fields: workflow,job,commit,repo + custom_payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "plain_text", + "emoji": true, + "text": "It appears that this pull request has not met the required Core Web Vitals score." + } + }, + { + "type": "divider" + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*User: <${{ github.event.pull_request.user.url }}|${{ github.event.pull_request.user.login }}>*\n*Link:* ${{ github.event.pull_request.html_url }}\n*Title:* ${{ github.event.pull_request.title }}\n*Status:* ${{ github.event.pull_request.state }}" + }, + "accessory": { + "type": "image", + "image_url": "${{ github.event.pull_request.user.avatar_url }}", + "alt_text": "${{ github.event.pull_request.user.login }}" + } + }, + { + "type": "divider" + }, + { + "type": "context", + "elements": [ + { + "type": "image", + "image_url": "https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", + "alt_text": "notifications warning icon" + }, + { + "type": "mrkdwn", + "text": "* please check the PR*" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6da8d4a2c2f..d1ed578b252 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,13 +1,13 @@ name: Lint permissions: - actions: write - checks: write - contents: write - deployments: write - pull-requests: write - statuses: write - + actions: write + checks: write + contents: write + deployments: write + pull-requests: write + statuses: write + on: push: branches-ignore: @@ -43,6 +43,15 @@ jobs: with: path: ./node_modules key: modules-${{ hashFiles('package-lock.json') }} + + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc + - name: Install Node.js dependencies run: | npm ci diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index aecf5574e76..abac3c78820 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -38,6 +38,14 @@ jobs: - name: Set version env variable run: echo "GATSBY_DERIV_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc + - run: npm ci - run: npm run format - run: npm run test @@ -79,18 +87,18 @@ jobs: docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME - name: Deploy 🚀 - env: + env: KUBE_SERVER: ${{ secrets.KUBE_SERVER }} SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} CA_CRT: ${{ secrets.CA_CRT }} NAMESPACE: deriv-com-production DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} run: | - git clone https://github.com/binary-com/devops-ci-scripts - cd devops-ci-scripts/k8s-build_tools - echo "${{ env.CA_CRT }}" | base64 --decode > ca.crt - export CA="ca.crt" - ./release.sh deriv-com ${{ github.ref_name }} + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo "${{ env.CA_CRT }}" | base64 --decode > ca.crt + export CA="ca.crt" + ./release.sh deriv-com ${{ github.ref_name }} - name: Slack Notification 📣 uses: 8398a7/action-slack@v3 diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 77c7c3c2da7..6df6ee9734f 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -39,6 +39,13 @@ jobs: with: node-version: '18.x' cache: 'npm' + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc - run: npm ci # - run: npm run format @@ -65,29 +72,29 @@ jobs: - name: Verify nginx image run: | - set -e - docker run --rm ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA nginx -t - echo "docker image validated successfully" + set -e + docker run --rm ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA nginx -t + echo "docker image validated successfully" - name: Pushing Image to docker hub 🐳 run: | - echo ${{ secrets.DOCKERHUB_PASSWORD }}| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:latest-staging - docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA + echo ${{ secrets.DOCKERHUB_PASSWORD }}| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin + docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:latest-staging + docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA - name: Deploy 🚀 - env: - KUBE_SERVER: ${{ secrets.KUBE_SERVER }} - SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} - CA_CRT: ${{ secrets.CA_CRT }} - NAMESPACE: deriv-com-staging - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} + env: + KUBE_SERVER: ${{ secrets.KUBE_SERVER }} + SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} + CA_CRT: ${{ secrets.CA_CRT }} + NAMESPACE: deriv-com-staging + DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} run: | - git clone https://github.com/binary-com/devops-ci-scripts - cd devops-ci-scripts/k8s-build_tools - echo "${{ env.CA_CRT }}" | base64 --decode > ca.crt - export CA="ca.crt" - ./release.sh deriv-com ${GITHUB_SHA} + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo "${{ env.CA_CRT }}" | base64 --decode > ca.crt + export CA="ca.crt" + ./release.sh deriv-com ${GITHUB_SHA} - name: Slack Notification 📣 uses: 8398a7/action-slack@v3 diff --git a/.github/workflows/sync-build-cache.yml b/.github/workflows/sync-build-cache.yml index 1cebcc0a64e..2a213cb8ba9 100644 --- a/.github/workflows/sync-build-cache.yml +++ b/.github/workflows/sync-build-cache.yml @@ -35,6 +35,14 @@ jobs: path: node_modules key: npm-${{ hashFiles('**/package-lock.json') }} + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc + - name: Install dependencies if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} run: npm ci diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 064920eba0c..9d8dda322cb 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -22,6 +22,14 @@ jobs: with: node-version: '18.x' + - name: Create npmrc file + shell: bash + run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc + + - name: Setup install read-only token for deriv-com org + shell: bash + run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc + - run: npm i -g @crowdin/cli - run: npm ci