Create cicd with different envt.yml

This commit is contained in:
minakshi 2024-11-13 21:50:10 +05:30 committed by GitHub
parent 20720ca4f9
commit e12b9eca79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,49 @@
name:CI/CD Pipeline
on:
push:
branches:
:main
:staging
:dev
jobs:
build:
runs-on:ubuntu-latest
steps:
name:Checkout code
uses:actions/checkout@v2
name:Set up node.js
uses:actions/setup-node@v2
with:
node-version:'14'
name:Install dependencies
run:npm install
name:Run tests
run:npm test
deploy:
runs-on:ubuntu-latest
needs:build
if:github.ref=='refs/heads/main'||github.ref=='refs/heads/main'||
github.ref=='refs/head/staging'||
github.ref=='refs/heads/dev'
steps:
name:Checkout code
uses:actions/checkout@v2
name:Deploy to Enviornment
env:
NODE_ENV:${{github.ref=='refs/heads/main'&&'production'||github.ref=='refs/heads/staging'&&'staging'||'development'}}
run:|
if["${{github.ref}}"=="refs/heads/main"];then
echo"Deploying to Production"
elif["${{github.ref}}"=="refs/heads/staging"];then
echo"Deploying to Staging"
else
echo "Deploying to Development"