From 8b0c85abfbafe256cdf70fd514c9705f4e5209ae Mon Sep 17 00:00:00 2001 From: nayan458 Date: Thu, 7 May 2026 14:06:48 +0530 Subject: [PATCH] Added new Ci --- .github/workflows/ci.yml | 47 --------------------------- .github/workflows/develop-deploy.yml | 46 ++++++++++++++++++++++++++ .github/workflows/pr-validation.yml | 38 ++++++++++++++++++++++ .github/workflows/release.yml | 48 ++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/develop-deploy.yml create mode 100644 .github/workflows/pr-validation.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 917ccca..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: CI/CD Pipeline - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Build with Maven - run: mvn clean compile - - # - name: Run tests - # run: mvn test - - - name: Build Docker image - run: docker build -t nayanmoni458/stoneinscription:backend-new . - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Push Docker image - run: docker push nayanmoni458/stoneinscription:backend-new - \ No newline at end of file diff --git a/.github/workflows/develop-deploy.yml b/.github/workflows/develop-deploy.yml new file mode 100644 index 0000000..a8a5ed6 --- /dev/null +++ b/.github/workflows/develop-deploy.yml @@ -0,0 +1,46 @@ +name: Develop Deployment + +on: + push: + branches: + - develop + +jobs: + build-and-push-dev: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Maven Dependencies + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + + - name: Build Application + run: mvn clean verify + + - name: Build Docker Image + run: | + docker build \ + -t nayanmoni458/stoneinscription:dev-latest \ + -t nayanmoni458/stoneinscription:sha-${GITHUB_SHA::7} . + + - name: Login To Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker Images + run: | + docker push nayanmoni458/stoneinscription:dev-latest + docker push nayanmoni458/stoneinscription:sha-${GITHUB_SHA::7} \ No newline at end of file diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..5c8831d --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,38 @@ +name: PR Validation + +on: + pull_request: + branches: + - develop + - main + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Maven Dependencies + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2 + + - name: Compile Project + run: mvn clean compile + + # - name: Run Unit Tests + # run: mvn test + + - name: Run Verify + run: mvn verify diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..493083d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release Pipeline + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Maven Dependencies + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + + - name: Run Full Validation + run: mvn clean verify + + - name: Build Docker Image + run: | + docker build \ + -t nayanmoni458/stoneinscription:${GITHUB_REF_NAME} \ + -t nayanmoni458/stoneinscription:latest \ + -t nayanmoni458/stoneinscription:sha-${GITHUB_SHA::7} . + + - name: Login To Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker Images + run: | + docker push nayanmoni458/stoneinscription:${GITHUB_REF_NAME} + docker push nayanmoni458/stoneinscription:latest + docker push nayanmoni458/stoneinscription:sha-${GITHUB_SHA::7} \ No newline at end of file