From 74a2d90b94ca0dcc6cc82fc24c4b4a46652f40a7 Mon Sep 17 00:00:00 2001 From: "Eugene P." Date: Thu, 24 Oct 2024 18:39:19 +0300 Subject: [PATCH] feat(tooling-ci): run CI check on pnpm dependency changes. (#3314) --- .github/workflows/_vercel_deploy.yml | 92 +++++++++++++++++++ .../apps-backend-production.deploy.yml | 48 ---------- ...iew.deploy.yml => apps-backend.deploy.yml} | 38 +++++--- .../apps-explorer-production.deploy.yml | 50 ---------- ...ew.deploy.yml => apps-explorer.deploy.yml} | 44 +++++---- .../apps-ui-kit-production.deploy.yml | 37 -------- ...view.deploy.yml => apps-ui-kit.deploy.yml} | 43 +++++---- ...pps-wallet-dashboard-production.deploy.yml | 50 ---------- ...y.yml => apps-wallet-dashboard.deploy.yml} | 44 +++++---- .github/workflows/hierarchy.yml | 20 ++++ .../src/restricted/restricted.controller.ts | 2 +- .../src/components/layout/PageLayout.tsx | 2 +- .../lib/components/atoms/divider/Divider.tsx | 2 +- .../lib/utils/vesting/vesting.ts | 2 +- 14 files changed, 221 insertions(+), 253 deletions(-) create mode 100644 .github/workflows/_vercel_deploy.yml delete mode 100644 .github/workflows/apps-backend-production.deploy.yml rename .github/workflows/{apps-backend-preview.deploy.yml => apps-backend.deploy.yml} (61%) delete mode 100644 .github/workflows/apps-explorer-production.deploy.yml rename .github/workflows/{apps-explorer-preview.deploy.yml => apps-explorer.deploy.yml} (62%) delete mode 100644 .github/workflows/apps-ui-kit-production.deploy.yml rename .github/workflows/{apps-ui-kit-preview.deploy.yml => apps-ui-kit.deploy.yml} (58%) delete mode 100644 .github/workflows/apps-wallet-dashboard-production.deploy.yml rename .github/workflows/{apps-wallet-dashboard-preview.deploy.yml => apps-wallet-dashboard.deploy.yml} (62%) diff --git a/.github/workflows/_vercel_deploy.yml b/.github/workflows/_vercel_deploy.yml new file mode 100644 index 00000000000..98ab8dedbba --- /dev/null +++ b/.github/workflows/_vercel_deploy.yml @@ -0,0 +1,92 @@ +name: Vercel Deploys + +on: + workflow_call: + inputs: + isExplorer: + type: boolean + required: true + isTypescriptSDK: + type: boolean + required: true + isAppsBackend: + type: boolean + required: true + isAppsUiKit: + type: boolean + required: true + isWalletDashboard: + type: boolean + required: true + shouldDeployPreview: + type: boolean + required: true + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + explorer-preview: + name: Vercel Explorer Preview + if: inputs.shouldDeployPreview && inputs.isExplorer + uses: ./.github/workflows/apps-explorer.deploy.yml + secrets: inherit + with: + isProd: false + + explorer-prod: + name: Vercel Explorer Production + if: github.ref_name == 'develop' && inputs.isExplorer + uses: ./.github/workflows/apps-explorer.deploy.yml + secrets: inherit + with: + isProd: true + + ui-kit-preview: + name: Vercel UI Kit Preview + if: inputs.shouldDeployPreview && inputs.isAppsUiKit + uses: ./.github/workflows/apps-ui-kit.deploy.yml + secrets: inherit + with: + isProd: false + + ui-kit-prod: + name: Vercel UI Kit Preview + if: github.ref_name == 'develop' && inputs.isAppsUiKit + uses: ./.github/workflows/apps-ui-kit.deploy.yml + secrets: inherit + with: + isProd: true + + wallet-dashboard-preview: + name: Vercel Wallet Dashboard Preview + if: inputs.shouldDeployPreview && inputs.isWalletDashboard + uses: ./.github/workflows/apps-wallet-dashboard.deploy.yml + secrets: inherit + with: + isProd: false + + wallet-dashboard-prod: + name: Vercel Wallet Dashboard Production + if: github.ref_name == 'develop' && inputs.isWalletDashboard + uses: ./.github/workflows/apps-wallet-dashboard.deploy.yml + secrets: inherit + with: + isProd: true + + apps-backend-preview: + name: Vercel apps-backend Preview + if: inputs.shouldDeployPreview && inputs.isAppsBackend + uses: ./.github/workflows/apps-backend.deploy.yml + secrets: inherit + with: + isProd: false + + apps-backend-prod: + name: Vercel apps-backend Production + if: github.ref_name == 'develop' && inputs.isAppsBackend + uses: ./.github/workflows/apps-backend.deploy.yml + secrets: inherit + with: + isProd: true diff --git a/.github/workflows/apps-backend-production.deploy.yml b/.github/workflows/apps-backend-production.deploy.yml deleted file mode 100644 index 2e014786e91..00000000000 --- a/.github/workflows/apps-backend-production.deploy.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Production Deploy for Apps Backend - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.APPS_BACKEND_VERCEL_PROJECT_ID }} - -on: - push: - branches: - - develop - paths: - - "apps/apps-backend/**" - - ".github/workflows/apps-backend-production.deploy.yml" - -jobs: - deploy-production: - permissions: - contents: read - pull-requests: write - runs-on: [self-hosted] - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4 - - name: Install Nodejs - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # pin@v4 - with: - node-version: "20" - cache: "pnpm" - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 - with: - path: node_modules/.cache/turbo - key: turbo-${{ runner.os }}-${{ github.sha }} - restore-keys: | - turbo-${{ runner.os }}- - - name: Install Vercel CLI - run: pnpm add --global vercel@canary - - name: Pull Vercel Prod Environment - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Build the Apps Backend - run: pnpm apps-backend build - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/apps-backend-preview.deploy.yml b/.github/workflows/apps-backend.deploy.yml similarity index 61% rename from .github/workflows/apps-backend-preview.deploy.yml rename to .github/workflows/apps-backend.deploy.yml index 7c3981195f4..38c919e73f5 100644 --- a/.github/workflows/apps-backend-preview.deploy.yml +++ b/.github/workflows/apps-backend.deploy.yml @@ -1,17 +1,19 @@ -name: Preview Deploy for Apps Backend +name: Deploy for Apps Backend env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.APPS_BACKEND_VERCEL_PROJECT_ID }} on: - pull_request: - paths: - - "apps/apps-backend/**" - - ".github/workflows/apps-backend-preview.deploy.yml" + workflow_dispatch: + workflow_call: + inputs: + isProd: + type: boolean + required: true jobs: - deploy-preview: + deploy: permissions: contents: read pull-requests: write @@ -26,6 +28,18 @@ jobs: cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup Prod Flag + id: setup_prod_flags + run: | + if [[ "${{ inputs.isProd }}" = "true" ]]; then + echo "PROD_FLAG=--prod" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=production" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=" >> $GITHUB_OUTPUT + else + echo "PROD_FLAG=" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=preview" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=> vercel_output.txt" >> $GITHUB_OUTPUT + fi - name: Turbo Cache id: turbo-cache uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 @@ -36,18 +50,20 @@ jobs: turbo-${{ runner.os }}- - name: Install Vercel CLI run: pnpm add --global vercel@canary + - name: Pull Vercel Env variables (network configs) + run: vercel pull --yes --environment=${{steps.setup_prod_flags.outputs.ENVIRONMENT}} --token=${{ secrets.VERCEL_TOKEN }} - name: Build the Apps Backend run: pnpm apps-backend build - - name: Pull Vercel Environment - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Vercel Project Artifacts + run: vercel build ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt + run: vercel deploy ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --prebuilt --token=${{ secrets.VERCEL_TOKEN }} ${{ steps.setup_prod_flags.outputs.VERCEL_OUTPUT }} - name: Extract Deploy URL id: deploy_url + if: ${{ inputs.isProd == false }} run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT - name: Comment on pull request + if: ${{ inputs.isProd == false }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/apps-explorer-production.deploy.yml b/.github/workflows/apps-explorer-production.deploy.yml deleted file mode 100644 index 41bd81f1595..00000000000 --- a/.github/workflows/apps-explorer-production.deploy.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Deploy Explorer Prod - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.EXPLORER_VERCEL_PROJECT_ID }} - -on: - push: - branches: - - develop - paths: - - "apps/explorer/**" - - ".github/workflows/apps-explorer-production.deploy.yml" - -jobs: - deploy-production: - permissions: - contents: read - pull-requests: write - runs-on: [self-hosted] - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4 - - name: Install Nodejs - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # pin@v4 - with: - node-version: "20" - cache: "pnpm" - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 - with: - path: node_modules/.cache/turbo - key: turbo-${{ runner.os }}-${{ github.sha }} - restore-keys: | - turbo-${{ runner.os }}- - - name: Install Vercel CLI - run: pnpm add --global vercel@canary - - name: Pull Vercel Env variables (network configs) - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Copy the .env file - run: cp ./.vercel/.env.production.local ./sdk/.env - - name: Build Explorer - run: pnpm explorer build - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/apps-explorer-preview.deploy.yml b/.github/workflows/apps-explorer.deploy.yml similarity index 62% rename from .github/workflows/apps-explorer-preview.deploy.yml rename to .github/workflows/apps-explorer.deploy.yml index b4b70604832..fe482d68102 100644 --- a/.github/workflows/apps-explorer-preview.deploy.yml +++ b/.github/workflows/apps-explorer.deploy.yml @@ -1,4 +1,4 @@ -name: Preview Deploy for Explorer +name: Deploy for Explorer env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -6,19 +6,14 @@ env: on: workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - paths: - - "apps/explorer/**" - - ".github/workflows/apps-explorer-preview.deploy.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + workflow_call: + inputs: + isProd: + type: boolean + required: true jobs: - deploy-preview: - if: github.event.pull_request.draft == false + deploy: permissions: contents: read pull-requests: write @@ -33,6 +28,18 @@ jobs: cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup Prod Flag + id: setup_prod_flags + run: | + if [[ "${{ inputs.isProd }}" = "true" ]]; then + echo "PROD_FLAG=--prod" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=production" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=" >> $GITHUB_OUTPUT + else + echo "PROD_FLAG=" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=preview" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=> vercel_output.txt" >> $GITHUB_OUTPUT + fi - name: Turbo Cache id: turbo-cache uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 @@ -44,21 +51,22 @@ jobs: - name: Install Vercel CLI run: pnpm add --global vercel@canary - name: Pull Vercel Env variables (network configs) - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + run: vercel pull --yes --environment=${{steps.setup_prod_flags.outputs.ENVIRONMENT}} --token=${{ secrets.VERCEL_TOKEN }} - name: Copy the .env file - run: cp ./.vercel/.env.preview.local ./sdk/.env + run: cp ./.vercel/.env.${{steps.setup_prod_flags.outputs.ENVIRONMENT}}.local ./sdk/.env - name: Build Explorer run: pnpm explorer build - - name: Build Project Artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Vercel Project Artifacts + run: vercel build ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt + run: vercel deploy ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --prebuilt --token=${{ secrets.VERCEL_TOKEN }} ${{ steps.setup_prod_flags.outputs.VERCEL_OUTPUT }} - name: Extract Deploy URL id: deploy_url + if: ${{ inputs.isProd == false }} run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT - name: Comment on pull request + if: ${{ inputs.isProd == false }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7 - if: github.event_name == 'pull_request' with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/apps-ui-kit-production.deploy.yml b/.github/workflows/apps-ui-kit-production.deploy.yml deleted file mode 100644 index 6e300bafee2..00000000000 --- a/.github/workflows/apps-ui-kit-production.deploy.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Production Deploy for Apps UI Kit Storybook - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.APPS_UI_KIT_VERCEL_PROJECT_ID }} - -on: - push: - branches: - - develop - paths: - - "apps/ui-kit/**" - - "apps/ui-icons/**" - - ".github/workflows/apps-ui-kit-production.deploy.yml" - -jobs: - deploy-production: - permissions: - contents: read - pull-requests: write - runs-on: [self-hosted] - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4 - - name: Install Nodejs - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # pin@v4 - with: - node-version: "20" - cache: "pnpm" - - name: Install Vercel CLI - run: pnpm add --global vercel@canary - - name: Pull Vercel Environment Information - run: vercel pull --cwd ./apps/ui-kit --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --prod --cwd ./apps/ui-kit --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --cwd ./apps/ui-kit --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/apps-ui-kit-preview.deploy.yml b/.github/workflows/apps-ui-kit.deploy.yml similarity index 58% rename from .github/workflows/apps-ui-kit-preview.deploy.yml rename to .github/workflows/apps-ui-kit.deploy.yml index fb76af6f4fb..bbb003fb875 100644 --- a/.github/workflows/apps-ui-kit-preview.deploy.yml +++ b/.github/workflows/apps-ui-kit.deploy.yml @@ -1,4 +1,4 @@ -name: Preview Deploy for Apps UI Kit Storybook +name: Deploy for Apps UI Kit Storybook env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -6,20 +6,14 @@ env: on: workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - paths: - - "apps/ui-kit/**" - - "apps/ui-icons/**" - - ".github/workflows/apps-ui-kit-preview.deploy.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + workflow_call: + inputs: + isProd: + type: boolean + required: true jobs: - deploy-preview: - if: github.event.pull_request.draft == false + deploy: permissions: contents: read pull-requests: write @@ -32,20 +26,35 @@ jobs: with: node-version: "20" cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Setup Prod Flag + id: setup_prod_flags + run: | + if [[ "${{ inputs.isProd }}" = "true" ]]; then + echo "PROD_FLAG=--prod" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=production" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=" >> $GITHUB_OUTPUT + else + echo "PROD_FLAG=" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=preview" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=> vercel_output.txt" >> $GITHUB_OUTPUT + fi - name: Install Vercel CLI run: pnpm add --global vercel@canary - name: Pull Vercel Environment Information - run: vercel pull --cwd ./apps/ui-kit --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + run: vercel pull --cwd ./apps/ui-kit --yes --environment=${{steps.setup_prod_flags.outputs.ENVIRONMENT}} --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts - run: vercel build --cwd ./apps/ui-kit --token=${{ secrets.VERCEL_TOKEN }} + run: vercel build ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --cwd ./apps/ui-kit --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --cwd ./apps/ui-kit --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt + run: vercel deploy --cwd ./apps/ui-kit ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --prebuilt --token=${{ secrets.VERCEL_TOKEN }} ${{ steps.setup_prod_flags.outputs.VERCEL_OUTPUT }} - name: Extract Deploy URL id: deploy_url + if: ${{ inputs.isProd == false }} run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT - name: Comment on pull request + if: ${{ inputs.isProd == false }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7 - if: github.event_name == 'pull_request' with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/apps-wallet-dashboard-production.deploy.yml b/.github/workflows/apps-wallet-dashboard-production.deploy.yml deleted file mode 100644 index 411aac1f7ef..00000000000 --- a/.github/workflows/apps-wallet-dashboard-production.deploy.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Production Deploy for Wallet Dashboard - -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.WALLET_DASHBOARD_VERCEL_PROJECT_ID }} - -on: - push: - branches: - - develop - paths: - - "apps/wallet-dashboard/**" - - ".github/workflows/apps-wallet-dashboard-production.deploy.yml" - -jobs: - deploy-production: - permissions: - contents: read - pull-requests: write - runs-on: [self-hosted] - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4 - - name: Install Nodejs - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # pin@v4 - with: - node-version: "20" - cache: "pnpm" - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 - with: - path: node_modules/.cache/turbo - key: turbo-${{ runner.os }}-${{ github.sha }} - restore-keys: | - turbo-${{ runner.os }}- - - name: Install Vercel CLI - run: pnpm add --global vercel@canary - - name: Pull Vercel Env variables (network configs) - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Copy the .env file - run: cp ./.vercel/.env.production.local ./sdk/.env - - name: Build Wallet Dashboard Local - run: pnpm wallet-dashboard build - - name: Build Vercel Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/apps-wallet-dashboard-preview.deploy.yml b/.github/workflows/apps-wallet-dashboard.deploy.yml similarity index 62% rename from .github/workflows/apps-wallet-dashboard-preview.deploy.yml rename to .github/workflows/apps-wallet-dashboard.deploy.yml index e7d6b8f0041..97bd8ae6670 100644 --- a/.github/workflows/apps-wallet-dashboard-preview.deploy.yml +++ b/.github/workflows/apps-wallet-dashboard.deploy.yml @@ -1,4 +1,4 @@ -name: Preview Deploy for Wallet Dashboard +name: Deploy for Wallet Dashboard env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -6,19 +6,14 @@ env: on: workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - paths: - - "apps/wallet-dashboard/**" - - ".github/workflows/apps-wallet-dashboard-preview.deploy.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + workflow_call: + inputs: + isProd: + type: boolean + required: true jobs: - deploy-preview: - if: github.event.pull_request.draft == false + deploy: permissions: contents: read pull-requests: write @@ -33,6 +28,18 @@ jobs: cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup Prod Flag + id: setup_prod_flags + run: | + if [[ "${{ inputs.isProd }}" = "true" ]]; then + echo "PROD_FLAG=--prod" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=production" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=" >> $GITHUB_OUTPUT + else + echo "PROD_FLAG=" >> $GITHUB_OUTPUT + echo "ENVIRONMENT=preview" >> $GITHUB_OUTPUT + echo "VERCEL_OUTPUT=> vercel_output.txt" >> $GITHUB_OUTPUT + fi - name: Turbo Cache id: turbo-cache uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # pin@v4 @@ -44,21 +51,22 @@ jobs: - name: Install Vercel CLI run: pnpm add --global vercel@canary - name: Pull Vercel Env variables (network configs) - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + run: vercel pull --yes --environment=${{steps.setup_prod_flags.outputs.ENVIRONMENT}} --token=${{ secrets.VERCEL_TOKEN }} - name: Copy the .env file - run: cp ./.vercel/.env.preview.local ./sdk/.env + run: cp ./.vercel/.env.${{steps.setup_prod_flags.outputs.ENVIRONMENT}}.local ./sdk/.env - name: Build Wallet Dashboard run: pnpm wallet-dashboard build - - name: Build Project Artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Vercel Project Artifacts + run: vercel build ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt + run: vercel deploy ${{steps.setup_prod_flags.outputs.PROD_FLAG}} --prebuilt --token=${{ secrets.VERCEL_TOKEN }} ${{ steps.setup_prod_flags.outputs.VERCEL_OUTPUT }} - name: Extract Deploy URL id: deploy_url + if: ${{ inputs.isProd == false }} run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT - name: Comment on pull request + if: ${{ inputs.isProd == false }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7 - if: github.event_name == 'pull_request' with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/hierarchy.yml b/.github/workflows/hierarchy.yml index f028b93b236..771df127243 100644 --- a/.github/workflows/hierarchy.yml +++ b/.github/workflows/hierarchy.yml @@ -25,6 +25,9 @@ jobs: isWallet: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-wallet')) }} isExplorer: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-explorer')) }} isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@iota/iota-sdk')) }} + isAppsBackend: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'apps-backend')) }} + isAppsUiKit: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@iota/apps-ui-kit')) }} + isWalletDashboard: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'wallet-dashboard')) }} isGraphQlTransport: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@iota/graphql-transport')) }} steps: - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 @@ -144,3 +147,20 @@ jobs: isTypescriptSDK: ${{ needs.diff.outputs.isTypescriptSDK == 'true' }} isGraphQlTransport: ${{ needs.diff.outputs.isGraphQlTransport == 'true' }} isDevelop: ${{ github.ref_name == 'develop' }} + + vercel-deploy: + if: (!cancelled() && !failure()) + needs: + - diff + - dprint-format + - license-check + - typos + uses: ./.github/workflows/_vercel_deploy.yml + secrets: inherit + with: + shouldDeployPreview: ${{github.event_name == 'pull_request' && github.event.pull_request.draft == false}} + isExplorer: ${{ needs.diff.outputs.isExplorer == 'true' }} + isTypescriptSDK: ${{ needs.diff.outputs.isTypescriptSDK == 'true' }} + isAppsBackend: ${{ needs.diff.outputs.isAppsBackend == 'true' }} + isAppsUiKit: ${{ needs.diff.outputs.isAppsUiKit == 'true' }} + isWalletDashboard: ${{ needs.diff.outputs.isWalletDashboard == 'true' }} diff --git a/apps/apps-backend/src/restricted/restricted.controller.ts b/apps/apps-backend/src/restricted/restricted.controller.ts index 03f77358e06..4ba61ddd045 100644 --- a/apps/apps-backend/src/restricted/restricted.controller.ts +++ b/apps/apps-backend/src/restricted/restricted.controller.ts @@ -9,7 +9,7 @@ export class RestrictedController { @Post('/') @Header('Cache-Control', 'max-age=0, must-revalidate') checkRestrictions(@Res() res: Response) { - // No restrictions implemented yet + // No restrictions implemented yet. res.status(HttpStatus.OK).send(); } } diff --git a/apps/explorer/src/components/layout/PageLayout.tsx b/apps/explorer/src/components/layout/PageLayout.tsx index dcd7ca952c8..9602bad3c85 100644 --- a/apps/explorer/src/components/layout/PageLayout.tsx +++ b/apps/explorer/src/components/layout/PageLayout.tsx @@ -29,7 +29,7 @@ export function PageLayout({ content, loading }: PageLayoutProps): JSX.Element { request<{ degraded: boolean }>('monitor-network', { project: 'EXPLORER', }), - // Keep cached for 2 minutes: + // Keep cached for 2 minutes staleTime: 2 * 60 * 1000, retry: false, enabled: network === Network.Mainnet, diff --git a/apps/ui-kit/src/lib/components/atoms/divider/Divider.tsx b/apps/ui-kit/src/lib/components/atoms/divider/Divider.tsx index afdae876ae3..a9391cfe151 100644 --- a/apps/ui-kit/src/lib/components/atoms/divider/Divider.tsx +++ b/apps/ui-kit/src/lib/components/atoms/divider/Divider.tsx @@ -33,7 +33,7 @@ export function Divider({ height, lineHeight = DEFAULT_LINE_HEIGHT, }: DividerProps): React.JSX.Element { - // Set width and height of divider line based on type + // Set height and width of divider line based on type const lineStyle = { ...(type === DividerType.Horizontal ? { height: lineHeight } : { width: lineHeight }), }; diff --git a/apps/wallet-dashboard/lib/utils/vesting/vesting.ts b/apps/wallet-dashboard/lib/utils/vesting/vesting.ts index 90ee486b504..157914ecca9 100644 --- a/apps/wallet-dashboard/lib/utils/vesting/vesting.ts +++ b/apps/wallet-dashboard/lib/utils/vesting/vesting.ts @@ -145,7 +145,7 @@ export function getVestingOverview( const userType = getSupplyIncreaseVestingUserType([latestPayout]); const vestingPayoutsCount = getSupplyIncreaseVestingPayoutsCount(userType!); - // note: we add the initial payout to the total rewards, 10% of the total rewards are paid out immediately + // Note: we add the initial payout to the total rewards, 10% of the total rewards are paid out immediately const totalVestedAmount = (vestingPayoutsCount * latestPayout.amount) / 0.9; const vestingPortfolio = buildSupplyIncreaseVestingSchedule( latestPayout,