-
Notifications
You must be signed in to change notification settings - Fork 0
Automation deployment for staging and prod #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ayush8923
wants to merge
8
commits into
main
Choose a base branch
from
feat/frontend-cicd-deployment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6c3d49c
feat(*): automation deployment for staging and prod
Ayush8923 725f60f
chore: refine log separators in deployment script
Ayush8923 ff4167b
fix(*): added the environment name in deployment pipeline
Ayush8923 8d79917
fix(*): update naming convention
Ayush8923 dd273e3
Merge branch 'main' into feat/frontend-cicd-deployment
Prajna1999 e8ca6ee
feat: testing CD on branch
Prajna1999 3e4b468
Merge branch 'main' into feat/frontend-cicd-deployment
Ayush8923 c1eb2e5
fix(*): update the readme and prduction deployment also
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy Kaapi to EC2 Production | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" # Deploy only when tags like v1.0.0, v2.1.0, etc., are created | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Deploy Kaapi Frontend to EC2 Production | ||
| runs-on: ubuntu-latest | ||
| environment: AWS_PRODUCTION_ENV | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Deploy via SSH | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| PM2_APP_NAME: ${{ secrets.PM2_APP_NAME }} | ||
| BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }} | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_SSH_KEY }} | ||
| script_stop: true | ||
| script: | | ||
| set -e | ||
|
|
||
| echo "=== Navigating to Project Directory ===" | ||
| cd $BUILD_DIRECTORY | ||
|
|
||
| echo "=== Fetch Latest Code ===" | ||
| git pull origin release | ||
|
|
||
| echo "=== Stop Running Application ===" | ||
| pm2 stop "$PM2_APP_NAME" || true | ||
|
|
||
| echo "=== Install Dependencies ===" | ||
| npm ci | ||
|
|
||
| echo "=== Build Application ===" | ||
| npm run build | ||
|
|
||
| echo "=== Start Application ===" | ||
| pm2 start "$PM2_APP_NAME" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy Kaapi to EC2 Staging | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - feat/frontend-cicd-deployment | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Deploy Kaapi Frontend to EC2 Staging | ||
| runs-on: ubuntu-latest | ||
| environment: AWS_STAGING_ENV | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Deploy via SSH | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| PM2_APP_NAME: ${{ secrets.PM2_APP_NAME }} | ||
| BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }} | ||
| with: | ||
Ayush8923 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_SSH_KEY }} | ||
Ayush8923 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| script_stop: true | ||
Ayush8923 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| script: | | ||
| set -e | ||
|
|
||
| echo "=== Navigating to Project Directory ===" | ||
| cd $BUILD_DIRECTORY | ||
|
|
||
| echo "=== Fetch Latest Code ===" | ||
| git pull origin main | ||
|
|
||
| echo "=== Stop Running Application ===" | ||
| pm2 stop "$PM2_APP_NAME" || true | ||
|
|
||
| echo "=== Install Dependencies ===" | ||
| npm ci | ||
|
|
||
| echo "=== Build Application ===" | ||
| npm run build | ||
|
|
||
| echo "=== Start Application ===" | ||
| pm2 start "$PM2_APP_NAME" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.