diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6d8ffe4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI Pipeline + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build: + name: Build with Gradle + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + + - name: Grant execute permission for Gradle + run: chmod +x gradlew + + - name: Build the project + run: ./gradlew build + + publish: + name: Publish to GitHub Packages + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/master' + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + + - name: Grant execute permission for Gradle + run: chmod +x gradlew + + - name: Publish to GitHub Packages + run: ./gradlew publish + env: + GPR_USER: ${{ secrets.GPR_USER }} + GPR_TOKEN: ${{ secrets.GPR_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 2fed043..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,37 +0,0 @@ -stages: - - build - - sonar - - publish - -variables: - PROJECT_PREFIX: "pn" - CI_PROJECT_NAMESPACE: "company-pn" - -before_script: - - export GRADLE_USER_HOME=`pwd`/.gradle - -publish: - stage: publish - image: registry.company.com/gitops/templates:gradle-8-jdk-21 - script: - - gradle publish - cache: - key: gradle-cache-key - paths: - - .gradle/caches - policy: pull - tags: - - noncluster-runner - only: - refs: - - tags - artifacts: - paths: - - build/libs/*.jar - -include: - - project: 'gitops/templates' - ref: master - file: - - '/gitlab-ci/.build.yml' - - '/gitlab-ci/.sonar.yml' diff --git a/README.md b/README.md index e7e69af..075bdb0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ![Checkstyle](https://img.shields.io/badge/Checkstyle-10.14.2-cyan) ![GitHub](https://img.shields.io/github/license/isopropylcyanide/Jwt-Spring-Security-JPA?color=blue) -A comprehensive common library built with Spring Boot 3.3 and Java 21, designed to streamline and standardize the development of microservices within your projects. +A comprehensive common library built with **Spring Boot 3.3** and **Java 21**, designed to streamline and standardize the development of microservices within your projects. `{PN}` - _project name or project name abbreviation_ @@ -66,9 +66,9 @@ implementation "com.company.project:springboot-microservice-common-lib:${pnCommo ```xml -com.company.project -springboot-microservice-common-lib -${pnCommonLibVersion} + com.company.project + springboot-microservice-common-lib + ${pnCommonLibVersion} ``` diff --git a/build.gradle b/build.gradle index c5e5734..7b288b9 100644 --- a/build.gradle +++ b/build.gradle @@ -38,22 +38,19 @@ publishing { maven(MavenPublication) { from components.java pom { - name = 'PN Common Library (java 21)' + name = 'PN Common Library (Java 21)' description = 'Common Library for PN' - url = 'https://gitlab.company.com/company-pn/springboot-microservice-common-lib' + url = 'https://github.com/mmushfiq/springboot-microservice-common-lib' } } } repositories { maven { - name "GitLab" - url "https://gitlab.company.com/api/v4/projects/${gitlabProjectId}/packages/maven" - credentials(HttpHeaderCredentials) { - name = 'Deploy-Token' - value = gitlabDeployToken - } - authentication { - header(HttpHeaderAuthentication) + name = "GitHub" + url = uri("https://maven.pkg.github.com/mmushfiq/springboot-microservice-common-lib") + credentials { + username = System.getenv("GPR_USER") ?: project.findProperty("gpr.user") ?: "" + password = System.getenv("GPR_TOKEN") ?: project.findProperty("gpr.token") ?: "" } } } diff --git a/gradle.properties b/gradle.properties index 110d4aa..a136b4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,4 @@ projectVersion = 0.0.1 - -gitlabProjectId = 123 -gitlabDeployToken = xxxxxxxxxxxxxxxxxxxx - springBootVersion = 3.3.3 springdocStarterVersion = 2.4.0 logstashLogbackVersion = 7.4