Skip to content

Commit

Permalink
Upload distributions to Cloudsmith
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 committed Oct 5, 2023
1 parent 4aa2e47 commit 984ae7d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ jobs:
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }}
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}

- name: Store distribution artifacts
uses: actions/upload-artifact@v3
with:
name: distributions
path: build/distributions
- name: Publish distribution artifacts
run: |
sudo apt update
sudo apt install -y python3 python3-pip python3-venv
./gradlew cloudsmithUpload
env:
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }}
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}

- name: Check Dockerfile syntax
run: |
Expand Down
22 changes: 15 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -590,23 +590,25 @@ distTar {
}
compression = Compression.GZIP
archiveExtension = 'tar.gz'
archiveBaseName = 'linea-besu'
}

distZip {
dependsOn checkLicenses, autocomplete, untunedStartScripts, evmToolStartScripts
doFirst {
delete fileTree(dir: 'build/distributions', include: '*.zip')
}
archiveBaseName = 'linea-besu'
}

publishing {
publications {
distArtifactory(MavenPublication) {
groupId = '.'
version = project.version
artifactId = 'besu'
artifact("$buildDir/distributions/besu-${project.version}.zip")
artifact("$buildDir/distributions/besu-${project.version}.tar.gz") { extension = 'tar.gz' }
artifactId = 'linea-besu'
artifact("$buildDir/distributions/linea-besu-${project.version}.zip")
artifact("$buildDir/distributions/linea-besu-${project.version}.tar.gz") { extension = 'tar.gz' }
}
}
}
Expand Down Expand Up @@ -1009,9 +1011,15 @@ distributions {
}
}

task cloudsmithUpload {
dependsOn([distTar, distZip])
doLast {
exec {
executable project.file("scripts/cloudsmith-upload.sh")
args rootProject.version, distTar.archiveFile.get(), distZip.archiveFile.get()
}
}
}

check.dependsOn checkSpdxHeader
build.dependsOn verifyDistributions
artifactoryPublish.dependsOn verifyDistributions
artifactoryPublish.mustRunAfter(distTar)
artifactoryPublish.mustRunAfter(distZip)
artifactoryPublish.mustRunAfter(javadocJar)
19 changes: 19 additions & 0 deletions scripts/cloudsmith-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

LINEA_BESU_VERSION=${1:?Must specify Linea Besu version}
TAR_DIST=${2:?Must specify path to tar distribution}
ZIP_DIST=${3:?Must specify path to zip distribution}

ENV_DIR=./build/tmp/cloudsmith-env
if [[ -d ${ENV_DIR} ]] ; then
source ${ENV_DIR}/bin/activate
else
python3 -m venv ${ENV_DIR}
source ${ENV_DIR}/bin/activate
fi

python3 -m pip install --upgrade cloudsmith-cli

cloudsmith push raw consensys/linea-besu $TAR_DIST --republish --name 'linea-besu.tar.gz' --version "${LINEA_BESU_VERSION}" --summary "Linea Besu ${LINEA_BESU_VERSION} binary distribution" --description "Binary distribution of Linea Besu ${LINEA_BESU_VERSION}." --content-type 'application/tar+gzip'
cloudsmith push raw consensys/linea-besu $ZIP_DIST --republish --name 'linea-besu.zip' --version "${LINEA_BESU_VERSION}" --summary "Linea Besu ${LINEA_BESU_VERSION} binary distribution" --description "Binary distribution of Linea Besu ${LINEA_BESU_VERSION}." --content-type 'application/zip'

0 comments on commit 984ae7d

Please sign in to comment.