Skip to content

Commit 84ef12d

Browse files
committed
Gate edge/latest S3 publish on master branch and fix md5 upload
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
1 parent bbf470f commit 84ef12d

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ String gitVersion() {
5353
return r==0 ? p.text.trim() : '(unknown)'
5454
}
5555

56+
String gitBranch() {
57+
def fromCI = System.env.GITHUB_REF_NAME
58+
if( fromCI ) return fromCI.trim()
59+
def p = new ProcessBuilder() .command('sh','-c','git rev-parse --abbrev-ref HEAD') .start()
60+
def r = p.waitFor()
61+
def out = r==0 ? p.text.trim() : ''
62+
return (out && out != 'HEAD') ? out : '(unknown)'
63+
}
64+
5665
group = 'io.nextflow'
5766
version = rootProject.file('VERSION').text.trim()
5867
ext.commitId = gitVersion()

packing.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ task dockerPack(type: Exec, dependsOn: ['packOne']) {
241241
task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions]) {
242242

243243
def launcherFile = file('nextflow').absoluteFile
244+
def launcherMd5 = file('nextflow.md5').absoluteFile
244245
def launcherSha1 = file('nextflow.sha1').absoluteFile
245246
def launcherSha256 = file('nextflow.sha256').absoluteFile
246247
def nextflowAllFile = file("$releaseDir/nextflow-${version}-dist")
@@ -249,6 +250,7 @@ task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions])
249250
def snapshot = version ==~ /^.+(-RC\d+|-SNAPSHOT)$/
250251
def edge = version ==~ /^.+(-edge|-EDGE)$/
251252
def isLatest = !snapshot && !edge
253+
def branch = gitBranch()
252254
def cmd = """\
253255
# tag the release
254256
git push || exit \$?
@@ -259,27 +261,27 @@ task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions])
259261
gh release upload --repo nextflow-io/nextflow v$version ${launcherFile} ${nextflowAllFile}
260262
""".stripIndent()
261263

262-
if( edge )
264+
if( edge && branch == 'master' )
263265
cmd += """
264266
# publish the script as the latest
265267
export AWS_ACCESS_KEY_ID=${System.env.NXF_AWS_ACCESS}
266268
export AWS_SECRET_ACCESS_KEY=${System.env.NXF_AWS_SECRET}
267269
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/edge/nextflow $s3CmdOpts
268270
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/edge/nextflow.sha1 $s3CmdOpts
269271
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/edge/nextflow.sha256 $s3CmdOpts
270-
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/edge/nextflow.md5 $s3CmdOpts
272+
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/edge/nextflow.md5 $s3CmdOpts
271273
aws s3 cp $versionFile s3://www2.nextflow.io/releases/edge/version $s3CmdOpts
272274
""".stripIndent()
273-
274-
else if( isLatest )
275+
276+
else if( isLatest && branch == 'master' )
275277
cmd += """
276278
# publish the script as the latest
277279
export AWS_ACCESS_KEY_ID=${System.env.NXF_AWS_ACCESS}
278280
export AWS_SECRET_ACCESS_KEY=${System.env.NXF_AWS_SECRET}
279281
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/latest/nextflow $s3CmdOpts
280282
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/latest/nextflow.sha1 $s3CmdOpts
281283
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.sha256 $s3CmdOpts
282-
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
284+
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
283285
aws s3 cp $versionFile s3://www2.nextflow.io/releases/latest/version $s3CmdOpts
284286
""".stripIndent()
285287

0 commit comments

Comments
 (0)