Skip to content

Commit

Permalink
FEAT:setup cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
rivopelu committed Nov 24, 2024
1 parent 9deef91 commit d88d51a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: DEPLOY STAGING

on:
push:
branches: [ "development" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: ./mvnw package -DskipTests=true -Dspring-boot.run.profiles=server

deploy-server-1:
needs: build
runs-on: ubuntu-latest
steps:
- name: RUNNING DEPLOY SERVER 1
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: 22
script: |
ls
systemctl status app
sudo systemctl stop app
sudo systemctl status app
echo ================= SERVER 1 STOP APPLICATION SUCCESS =================
cd app
ls
git checkout development
git pull origin development
echo ================= SERVER 1 PULL SUCCESS =================
mvn clean install
echo INSTALL SUCCESS
./mvnw package -DskipTests=true
echo ================= SERVER 1 BUILD SUCCESS =================
sudo mv target/app.jar ~/app-running/app.jar
echo ================= SERVER 1 MOVE APPLICATION SUCCESS =================
cd ~/app-running && ls
sudo systemctl start app
echo ================= START SUCCESS =================
sudo systemctl status app
echo ================= SERVER 1 DEPLOYING SUCCESS SERVER 1 =================
4 changes: 4 additions & 0 deletions src/main/java/com/pos/app/controller/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.pos.app.annotations.BaseController;
import com.pos.app.model.request.RequestSignIn;
import com.pos.app.model.response.BaseResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

Expand All @@ -15,4 +16,7 @@ public interface AuthController {
@PostMapping("v1/sign-in/super-admin")
BaseResponse signInSuperAdmin(@RequestBody RequestSignIn req);

@GetMapping("ping")
String ping();

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public BaseResponse signInStaff(RequestSignIn req) {
public BaseResponse signInSuperAdmin(RequestSignIn req) {
return ResponseHelper.createBaseResponse(authService.signInSuperAdmin(req));
}

@Override
public String ping() {
return "PONG";
}
}

0 comments on commit d88d51a

Please sign in to comment.