Skip to content

Commit

Permalink
Merge pull request #4 from bentran1vn/Config/WorkFlowAndEnv
Browse files Browse the repository at this point in the history
Config/work flow and env
  • Loading branch information
bentran1vn authored Sep 27, 2024
2 parents 200c2c2 + 0861e4c commit 4fed284
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/my-jobs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
name: My Jobs
name: CI/CD Pipeline

on:
push:
branches:
- '*' # Matches every branch
- '!main' # Excludes main branch
pull_request:
types:
- closed
branches:
- main
jobs:
build_and_deploy:
runs-on: [self-hosted]
env:
CONTAINER_NAME: myappCommandContainer
build:
runs-on: [ self-hosted ]
steps:
- uses: actions/checkout@v3
- name: Build Docker Image
run: docker build -t myapp-command:latest -f MBS-COMMAND.API/Dockerfile .
- name: Manage Docker Container and Build

deploy:
needs: build
runs-on: [self-hosted]
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
env:
CONTAINER_NAME: myappCommandContainer
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Deploy to Server
run: |
CNAME=${{ env.CONTAINER_NAME }}
Expand All @@ -34,4 +50,7 @@ jobs:
fi
# Run new container
echo ":: Running new container - $CNAME"
docker run -d --network=MBS --name $CNAME myapp-command:latest
docker run -d --network=MBS -p 4000:8080 --name $CNAME myapp-command:latest
- name: Notify Deployment
run: echo "Deployment completed successfully!"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,5 @@ Temporary Items

# End of https://www.toptal.com/developers/gitignore/api/macos,rider,intellij,aspnetcore,dotnetcore

docker-compose.yml
docker-compose.yml
MBS-COMMAND.API/logs
4 changes: 2 additions & 2 deletions MBS-COMMAND.API/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"ConnectionStrings": "Server=103.185.184.35;Database=PRNSUPPER;Uid=sa;Pwd=AnhBiLongDaiKa@;Trust Server Certificate=True;",
"Redis": "103.185.184.35:6379,password=Thientan291157@,abortConnect=false"
"ConnectionStrings": "Server=103.162.14.116;Database=PRN_SUPER;Uid=sa;Pwd=MyStrongPassword123@;Trust Server Certificate=True;",
"Redis": "103.162.14.116:6379,password=MyStrongPassword123@,abortConnect=false"
},
"JwtOption": {
"Issuer": "http://103.162.14.116:8080",
Expand Down
4 changes: 2 additions & 2 deletions MBS-COMMAND.API/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"ConnectionStrings": "Server=14.225.205.54;Database=AntreeDB;Uid=sa;Pwd=Thientan291157@;Trust Server Certificate=True;",
"Redis": "103.162.14.116:6379"
"ConnectionStrings": "Server=103.162.14.116;Database=PRN_SUPER;Uid=sa;Pwd=MyStrongPassword123@;Trust Server Certificate=True;",
"Redis": "103.162.14.116:6379,password=MyStrongPassword123@,abortConnect=false"
},
"JwtOption": {
"Issuer": "http://103.162.14.116:8080",
Expand Down

0 comments on commit 4fed284

Please sign in to comment.