Skip to content

Commit

Permalink
Merge pull request #4396 from signalco-io/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
AleksandarDev authored Jan 19, 2024
2 parents 15b8c79 + 95a1d71 commit 50719ac
Show file tree
Hide file tree
Showing 36 changed files with 1,241 additions and 1,034 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/cloud-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,42 @@ on:
paths:
- "cloud/**"
- "infra/**"
- "web/**"
- ".github/workflows/cloud-deploy.yml"
- ".github/workflows/infra-deploy_reusable.yml"
- ".github/workflows/vercel-deploy_reusable.yml"

jobs:
changes:
name: "Detect changes"
runs-on: ubuntu-latest
permissions:
pull-requests: read
contents: read
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
infrastructure:
- cloud/**
- infra/**
- .github/workflows/web-nextjs_bundle_analysis.yml
- .github/workflows/cloud-deploy-preview_reusable.yml
web:
- web/**
- .github/workflows/web-nextjs_bundle_analysis.yml
- .github/workflows/nextjs_bundle_analysis_reusable.yml
- .github/workflows/vercel-deploy_reusable.yml
outputs:
infra: ${{ steps.filter.outputs.infrastructure }}
web: ${{ steps.filter.outputs.web }}

infra_cloud-primary_up:
name: "Cloud Primary infrastructure (deploy)"
needs: changes
if: success() && needs.changes.outputs.infra == 'true'
uses: ./.github/workflows/infra-deploy_reusable.yml
with:
project: "cloud-primary"
Expand All @@ -23,9 +53,102 @@ jobs:

infra_uier_up:
name: "uier infrastructure (deploy)"
needs: changes
if: success() && needs.changes.outputs.infra == 'true'
uses: ./.github/workflows/infra-deploy_reusable.yml
with:
project: "uier"
baseRef: ${{ github.ref }}
command: "up"
secrets: inherit

vercel_blog_deploy:
name: "Vercel Blog (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'blog'
path: 'web/apps/blog'
vercelProjectId: 'prj_VT7qOjkcEvkAsZH7MtSxWcVDWVpr'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_brandgrab_deploy:
name: "Vercel BrandGrab (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'brandgrab'
path: 'web/apps/brandgrab'
vercelProjectId: 'prj_QHQO9V4WwYqlcpXNufZ4SU3Ryftx'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_slco_deploy:
name: "Vercel slco (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'slco'
path: 'web/apps/slco'
vercelProjectId: 'prj_GNETZANB7evyT5coH7gptur1G1sN'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_app_deploy:
name: "Vercel app (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'app'
path: 'web/apps/app'
vercelProjectId: 'prj_q8N5ElZfzvq4BjEMBIsyEfqe4jsI'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_web_deploy:
name: "Vercel web (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'web'
path: 'web/apps/web'
vercelProjectId: 'prj_PYE8WwpynTfjD6rVMiCp7sZoCPYw'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_doprocess_deploy:
name: "Vercel doprocess (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'doprocess'
path: 'web/apps/doprocess'
vercelProjectId: 'prj_UoJ8CHr3RAlOya6A9fpJ4oKzQhCJ'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit

vercel_uidocs_deploy:
name: "Vercel ui-docs (deploy)"
needs: changes
if: success() && needs.changes.outputs.web == 'true'
uses: ./.github/workflows/vercel-deploy_reusable.yml
with:
name: 'ui-docs'
path: 'web/apps/ui-docs'
vercelProjectId: 'prj_JTG4EUX7sXFIbDmgRxaNarffnq9E'
preview: false
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit
89 changes: 89 additions & 0 deletions .github/workflows/vercel-deploy_reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: '[Web] Vercel Deploy'

on:
workflow_call:
inputs:
name:
required: true
type: string
description: 'Name of the package or application to analzye'
path:
required: true
type: string
description: 'Path to the package or application to analzye'
vercelProjectId:
required: true
type: string
description: 'Vercel Project ID'
preview:
required: false
type: boolean
description: 'Whether to deploy to preview or production'
default: true
environment:
required: false
type: string
description: 'Environment to deploy to, can be preview, development, or production'
default: 'preview'

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: signalco
TURBO_REMOTE_ONLY: true
VERCEL_PROJECT_ID: ${{ inputs.vercelProjectId }}
VERCEL_ORG_ID: team_Ade0MlfC3211ml3wYJZ4c9hn

defaults:
run:
working-directory: ./web

jobs:
ci:
timeout-minutes: 15
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ inputs.name }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: ✨ Setup pnpm
uses: pnpm/[email protected]
with:
version: 'latest'

- name: ✨ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "pnpm"
cache-dependency-path: ./web/pnpm-lock.yaml

- name: 📦️ Install dependencies
run: pnpm install --frozen-lockfile --filter ${{ inputs.name }}... --filter .

- name: ✨ Setup Vercel CLI
run: pnpm add --global vercel@latest

- name: ⚙️ Pull Vercel Environment Information
run: vercel pull --yes --environment=${{ inputs.environment }} --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ${{ inputs.path }}/

- name: ⚒️ Build app
run: vercel build ${{ inputs.preview == false && '--prod' }} --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ${{ inputs.path }}/

- name: 🚀 Deploy Preview to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ${{ inputs.path }}/
if: ${{ inputs.preview == true }}

- name: 🚀 Deploy Production to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} ${{ inputs.environment == 'development' && '--skip-domain' }}
working-directory: ${{ inputs.path }}/
if: ${{ inputs.preview == false }}

Loading

0 comments on commit 50719ac

Please sign in to comment.