Skip to content

Commit 0770fa5

Browse files
Merge pull request #43 from Consensys/jar-artifact
push jar artifact to nexus on commits to main for snapshots
2 parents f942c46 + f5cb484 commit 0770fa5

File tree

4 files changed

+82
-24
lines changed

4 files changed

+82
-24
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: 'publish-to-artifactory'
3+
description: 'Composite action to publish to artifactory'
4+
inputs:
5+
publish-version:
6+
description: 'version to publish with'
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
13+
- name: Authneticate JFrog
14+
id: jfrog
15+
if: "!startsWith(github.ref, 'refs/tags/')"
16+
uses: jfrog/setup-jfrog-cli@v4
17+
env:
18+
JF_URL: "https://consensys.jfrog.io"
19+
with:
20+
oidc-provider-name: 'github'
21+
oidc-audience: ''
22+
23+
- name: Publish Artifactory
24+
id: artifactory
25+
if: "!startsWith(github.ref, 'refs/tags/')"
26+
shell: sh
27+
run: |
28+
./gradlew artifactoryPublish -PreleaseVersion=${{ inputs.publish-version }}
29+
env:
30+
ARTIFACTORY_USER: ${{ steps.jfrog.outputs.oidc-user }}
31+
ARTIFACTORY_PASSWORD: ${{ steps.jfrog.outputs.oidc-token }}

.github/workflows/ci.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ jobs:
5555
runs-on: ubuntu-latest
5656
env:
5757
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2
58-
5958
steps:
6059
- name: Checkout
6160
uses: actions/checkout@v4
@@ -90,3 +89,39 @@ jobs:
9089
with:
9190
name: jar
9291
path: 'build/libs/'
92+
93+
publishToArtifactory:
94+
needs:
95+
- assemble
96+
- unitTests
97+
runs-on: ubuntu-latest
98+
env:
99+
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2
100+
environment: publish
101+
permissions:
102+
contents: write
103+
id-token: write
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Setup Java and Gradle
109+
id: setup-java-gradle
110+
uses: ConsenSys/github-actions/java-setup-gradle@main
111+
with:
112+
DISTRIBUTION: 'adopt'
113+
114+
- name: Download workspace
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: workspace
118+
119+
- name: Determine version
120+
id: project_version
121+
uses: ConsenSys/github-actions/java-get-project-version@main
122+
123+
- name: Publish to artifactory
124+
if: "!startsWith(github.ref, 'refs/tags/')"
125+
uses: ./.github/actions/publish-to-artifactory
126+
with:
127+
publish-version: ${{ steps.project_version.outputs.specific-version }}

.github/workflows/release.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19-
- name: Set up JDK 21
20-
uses: actions/[email protected]
19+
- name: Setup Java and Gradle
20+
id: setup-java-gradle
21+
uses: ConsenSys/github-actions/java-setup-gradle@main
2122
with:
22-
java-version: '21'
23-
distribution: 'adopt'
24-
cache: 'gradle'
25-
26-
- name: Grant execute permission for gradlew
27-
run: chmod +x gradlew
23+
DISTRIBUTION: 'adopt'
2824

2925
- name: Get the version
3026
id: get_version
@@ -54,19 +50,9 @@ jobs:
5450
generate_release_notes: true
5551
fail_on_unmatched_files: true
5652
files: ./build/libs/besu-fleet-plugin-${{ steps.get_version.outputs.VERSION }}.jar
57-
58-
- name: Authneticate JFrog
59-
id: jfrog
60-
uses: jfrog/setup-jfrog-cli@v4
61-
env:
62-
JF_URL: "https://consensys.jfrog.io"
63-
with:
64-
oidc-provider-name: 'github'
65-
oidc-audience: ''
6653

67-
- name: Publish Artifactory
68-
id: artifactory
69-
run: ./gradlew artifactoryPublish -PreleaseVersion=${{ steps.get_version.outputs.VERSION }}
70-
env:
71-
ARTIFACTORY_USER: ${{ steps.jfrog.outputs.oidc-user }}
72-
ARTIFACTORY_PASSWORD: ${{ steps.jfrog.outputs.oidc-token }}
54+
- name: Publish to artifactory
55+
if: "!startsWith(github.ref, 'refs/tags/')"
56+
uses: ./.github/actions/publish-to-artifactory
57+
with:
58+
publish-version: ${{ steps.get_version.outputs.VERSION }}

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ task plugin(dependsOn: 'jar') {
235235
description 'Alias for the jar task'
236236
}
237237

238+
task printVersion() {
239+
doFirst {
240+
println "specific-version=${calculateVersion()}"
241+
println "publish-version=${project.version}"
242+
}
243+
}
238244

239245
@Memoized
240246
def calculateVersion() {

0 commit comments

Comments
 (0)