Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .github/main-push-pr.yml
Empty file.
144 changes: 144 additions & 0 deletions .github/workflows/development-pr-open.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Dev Branch PR or Push

on:
push:
branches: [dev]
pull_request:
branches: [dev]
types: [opened, reopened, synchronize]

jobs:
install:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron
cache: "npm"

- name: Clear Install Dependecies
run: npm ci

build:
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron
cache: "npm"

- name: Clear Install Dependecies
run: npm ci

- name: Build
run: npm run build

lint:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron

- name: Clear Install Dependecies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

# e2e-install-all-deps-with-cypress:
# needs: lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install dependencies
# uses: cypress-io/github-action@v6
# with:
# # just perform install
# runTests: false

# # - name: Lint
# # run: npm run lint

# - name: Run e2e tests
# uses: cypress-io/github-action@v6
# with:
# # we have already installed all dependencies above
# install: false
# build: npm run build
# start: npm start
# wait-on: http://localhost:3000
# # Custom: Cypress tests and config file are in "e2e" folder
# # working-directory: e2e

e2e-cypress-only:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cache/Cypress
node_modules
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install Cypress only
run: npm i cypress

- name: Run e2e tests
uses: cypress-io/github-action@v6
with:
# we have already installed all dependencies above
install: false
build: npm run build
start: npm start
wait-on: http://localhost:3000
# Custom: Cypress tests and config file are in "e2e" folder
# working-directory: e2e

deploy-preview:
needs: e2e-cypress-only
if: github.event.pull_request.merged == false
uses: ./.github/workflows/preview-pr-open.yml
secrets: inherit # needs this whenever we use reusables otherwise secrets won't work


# how to make a version to build for dev branch
# deploy-dev:
147 changes: 147 additions & 0 deletions .github/workflows/main-push-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Main Branch PR or Push

on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]

jobs:
install:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron
cache: "npm"

- name: Clear Install Dependecies
run: npm ci

build:
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron
cache: "npm"

- name: Clear Install Dependecies
run: npm ci

- name: Build
run: npm run build

lint:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/iron

- name: Clear Install Dependecies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

# e2e-install-all-deps-with-cypress:
# needs: lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install dependencies
# uses: cypress-io/github-action@v6
# with:
# # just perform install
# runTests: false

# # - name: Lint
# # run: npm run lint

# - name: Run e2e tests
# uses: cypress-io/github-action@v6
# with:
# # we have already installed all dependencies above
# install: false
# build: npm run build
# start: npm start
# wait-on: http://localhost:3000
# # Custom: Cypress tests and config file are in "e2e" folder
# # working-directory: e2e

e2e-cypress-only:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cache/Cypress
node_modules
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install Cypress only
run: npm i cypress

- name: Run e2e tests
uses: cypress-io/github-action@v6
with:
# we have already installed all dependencies above
install: false
build: npm run build
start: npm start
wait-on: http://localhost:3000
# Custom: Cypress tests and config file are in "e2e" folder
# working-directory: e2e

deploy-preview:
needs: e2e-cypress-only
if: github.event.pull_request.merged == false
uses: ./.github/workflows/reusable-preview-pr-open.yml
secrets: inherit # needs this whenever we use reusables otherwise secrets won't work

deploy-prod:
needs: e2e-cypress-only
if: github.event.pull_request.merged == true
uses: ./.github/workflows/reusable-deploy-prod.yml
secrets: inherit # needs this whenever we use reusables otherwise secrets won't work

40 changes: 40 additions & 0 deletions .github/workflows/reusable-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Vercel Production Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
# push:
# branches:
# - main
workflow_call:
inputs:
stage:
type: string
required: false
environment:
type: string
required: false
affected:
type: boolean
default: false
required: false

jobs:
Deploy-Production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/reusable-preview-pr-open.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Vercel PR Preview Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

# on:
# push:
# branches-ignore:
# - main
# pull_request:
# branches: [main]
# types: [opened, reopened, synchronize]

on:
workflow_call:
inputs:
stage:
type: string
required: false
environment:
type: string
required: false
affected:
type: boolean
default: false
required: false

jobs:
Deploy-Preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Loading
Loading