Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Fix release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
yonatankarp committed Dec 23, 2021
1 parent 31ad103 commit 2d7efe8
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
service: [ rabbit-hole, demo-app ]
artifact: [ rabbit-hole, demo-app ]

steps:

Expand Down Expand Up @@ -46,4 +46,4 @@ jobs:
id: check-style
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew ${{ matrix.service }}:spotlessCheck
run: ./gradlew ${{ matrix.artifact }}:spotlessCheck
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/[email protected]
with:
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
# This action should be triggered on any PR merge to our main branch
name: Release

on:
push:
branches:
- main
release:
types: [published]

jobs:
artifact:
name: Artifact
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/[email protected]

- name: Get Release Tag
id: previoustag
uses: WyriHaximus/[email protected]
- 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
31 changes: 0 additions & 31 deletions buildSrc/src/main/groovy/rabbit-hole.publishing-conventions.gradle

This file was deleted.

3 changes: 2 additions & 1 deletion demo-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ bootJar {
}

repositories {
mavenLocal()
mavenCentral()
maven {
name = "Rabbit Hole"
Expand All @@ -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'
Expand Down
38 changes: 28 additions & 10 deletions rabbit-hole/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
}
}
}
}

0 comments on commit 2d7efe8

Please sign in to comment.