Skip to content

Commit

Permalink
added generic workflow to deploy to corresponding environments
Browse files Browse the repository at this point in the history
  • Loading branch information
naumanzchaudhry committed Oct 8, 2024
1 parent 6ae423e commit 6d2be89
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy UI and API

on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'uat'
type: choice
options:
- uat
- prod

jobs:
deploy_ui_and_api:
runs-on: ubuntu-latest

steps:
- name: Check environment
run: echo "Deploying to ${{ github.event.inputs.environment }} environment"

# Deploy UI
- name: Trigger UI Deployment
uses: actions/github-script@v6
with:
script: |
const branchToDeploy = '${{ github.event.inputs.environment }}' === 'prod' ? 'main' : 'uat';
const response = await github.actions.createWorkflowDispatch({
owner: 'naumanzchaudhry',
repo: 'tasker-ui',
workflow_id: 'deploy.yml',
ref: branchToDeploy,
inputs: {
environment: "${{ github.event.inputs.environment }}"
}
});
console.log('Triggered UI deployment:', response.status);
# Deploy API
- name: Trigger API Deployment
uses: actions/github-script@v6
with:
script: |
const branchToDeploy = '${{ github.event.inputs.environment }}' === 'prod' ? 'main' : 'uat';
const response = await github.actions.createWorkflowDispatch({
owner: 'naumanzchaudhry',
repo: 'tasker-api',
workflow_id: 'deploy.yml',
ref: branchToDeploy,
inputs: {
environment: "${{ github.event.inputs.environment }}"
}
});
console.log('Triggered API deployment:', response.status);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TDD in Legacy Code Transformation
# Tasker App - TDD in Legacy Code Transformation

## Pipeline Dashboard

Expand Down

0 comments on commit 6d2be89

Please sign in to comment.