diff --git a/.github/workflows/check_style.yml b/.github/workflows/check_style.yml index a4986a8..096ee23 100644 --- a/.github/workflows/check_style.yml +++ b/.github/workflows/check_style.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - service: [ rabbit-hole, demo-app ] + artifact: [ rabbit-hole, demo-app ] steps: @@ -46,4 +46,4 @@ jobs: id: check-style env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew ${{ matrix.service }}:spotlessCheck + run: ./gradlew ${{ matrix.artifact }}:spotlessCheck diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcf4102..0dffb74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,8 @@ jobs: strategy: fail-fast: false matrix: - service: [ rabbit-hole, demo-app ] + artifact: [ rabbit-hole, demo-app ] runs-on: ubuntu-latest - env: - APPLICATION_NAME: ${{ matrix.service }} steps: - name: Install Java @@ -49,8 +47,7 @@ jobs: id: build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew ${{ matrix.service }}:build - + run: ./gradlew ${{ matrix.artifact }}:build - uses: codecov/codecov-action@v2.1.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07ebb9a..31920df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ -# This action should be triggered on any PR merge to our main branch +name: Release + on: - push: - branches: - - main + release: + types: [published] jobs: artifact: @@ -10,36 +10,33 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - service: [ rabbit-hole ] + artifact: [ rabbit-hole ] + steps: + - name: Install Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v2.4.0 with: java-version: 11 distribution: 'adopt' - - name: Git Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/checkout@v2.4.0 - - name: Get Release Tag - id: previoustag - uses: WyriHaximus/github-action-get-previous-tag@v1.1 + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::$(git describe --tags | cut -d- -f 1) - name: Set Artifact Version run: | - echo Artifact version: ${{ steps.previoustag.outputs.tag }} - echo "version=${{ steps.previoustag.outputs.tag }}" > gradle.properties + echo Artifact version: ${{ steps.get_version.outputs.VERSION }} + echo "version=${{ steps.get_version.outputs.VERSION }}" > gradle.properties - - name: Gradle Build Artifact - id: build + - name: Build Artifact env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew ${{ matrix.service }}:build + run: ./gradlew ${{ matrix.artifact }}:build - name: Publish Artifact - id: build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew ${{ matrix.service }}:publish + run: ./gradlew ${{ matrix.artifact }}:publish diff --git a/buildSrc/src/main/groovy/rabbit-hole.publishing-conventions.gradle b/buildSrc/src/main/groovy/rabbit-hole.publishing-conventions.gradle deleted file mode 100644 index 2a9e2c4..0000000 --- a/buildSrc/src/main/groovy/rabbit-hole.publishing-conventions.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id('maven-publish') -} - -publishing { - publications { - maven(MavenPublication) { - groupId = 'com.yonatankarp' - artifactId = project.name - version = project.version - - from components.java - versionMapping { - usage('java-runtime') { - fromResolutionResult() - } - } - } - } - - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/yonatankarp/rabbit-hole") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } - } -} diff --git a/demo-app/build.gradle b/demo-app/build.gradle index 116813e..2eda6a3 100644 --- a/demo-app/build.gradle +++ b/demo-app/build.gradle @@ -20,6 +20,7 @@ bootJar { } repositories { + mavenLocal() mavenCentral() maven { name = "Rabbit Hole" @@ -35,7 +36,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-amqp' - implementation "com.yonatankarp:rabbit-hole:+" + implementation "com.yonatankarp:rabbit-hole:0.0.0+" testImplementation("org.springframework.boot:spring-boot-starter-test") { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' diff --git a/rabbit-hole/build.gradle b/rabbit-hole/build.gradle index d9c7ddb..2bf1667 100644 --- a/rabbit-hole/build.gradle +++ b/rabbit-hole/build.gradle @@ -8,18 +8,8 @@ plugins { id "com.diffplug.spotless" } -group = 'com.yonatankarp' -version "${version}" -sourceCompatibility = '11' - -repositories { - mavenCentral() -} - jar { enabled = true - archivesBaseName = project.name - version = project.version } bootJar { @@ -45,3 +35,31 @@ test { finalizedBy spotlessApply finalizedBy jacocoTestReport } + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.yonatankarp' + artifactId = project.name + version = project.version + + from components.java + versionMapping { + usage('java-runtime') { + fromResolutionResult() + } + } + } + } + + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/yonatankarp/rabbit-hole") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } + } +}