Skip to content

Commit

Permalink
chore: Add JReleaser configuration & templates (quarkusio#899)
Browse files Browse the repository at this point in the history
* [minor] various fixes

* chore: Add JReleaser configuraiton & templates

* chore: exclude JReleaser output from spotless checks

* chore: refine JReleaser configuration

* build: first set of removals in build/workflow for when jreleaser runs

* use right doc url

* fix: magic jreleaser fixes

Co-authored-by: Max Rydahl Andersen <manderse@redhat.com>
Co-authored-by: Max Rydahl Andersen <gitkraken@xam.dk>
  • Loading branch information
3 people committed Jul 15, 2021
1 parent c470cfa commit 31b2800
Show file tree
Hide file tree
Showing 18 changed files with 202 additions and 338 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ on:
- published

name: release-3rdparty
jobs:
jobs:
build:
runs-on: ubuntu-latest
name: build-and-testing
env:
JRELEASER_SDKMAN_CONSUMER_KEY: ${{ secrets.SDKMAN_CONSUMER_KEY }}
JRELEASER_SDKMAN_CONSUMER_TOKEN: ${{ secrets.SDKMAN_CONSUMER_TOKEN }}
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_TOKEN_SECRET }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: install-java11
Expand All @@ -24,16 +32,10 @@ jobs:
run: ./misc/updatecontainer.sh
- name: homebrew
continue-on-error: true
env:
BREW_GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
BREW_USER: ${{ secrets.BREW_USER }}
run: ./misc/updatebrew.sh
run: jreleaser publish --tool-name brew
- name: scoop
continue-on-error: true
env:
BREW_GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
BREW_USER: ${{ secrets.BREW_USER }}
run: ./misc/updatescoop.sh
run: jreleaser publish --tool-name scoop
- name: spec
continue-on-error: true
env:
Expand All @@ -42,16 +44,10 @@ jobs:
run: ./misc/updatespec.sh
- name: snap
continue-on-error: true
env:
BREW_GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
BREW_USER: ${{ secrets.BREW_USER }}
run: ./misc/updatesnap.sh
run: jreleaser publish --tool-name snap
- name: sdkman
continue-on-error: true
env:
SDKMAN_CONSUMER_KEY: ${{ secrets.SDKMAN_CONSUMER_KEY }}
SDKMAN_CONSUMER_TOKEN: ${{ secrets.SDKMAN_CONSUMER_TOKEN }}
run: ./misc/updatesdkman.sh
run: jreleaser announce -an sdkman
- name: upload-choco
uses: actions/upload-artifact@v1
with:
Expand Down
68 changes: 1 addition & 67 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spotless {
lineEndings 'UNIX'
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
targetExclude 'CONTRIBUTORS.md', 'src/main/scripts/container/README.md', 'build/container/README.md', ' build/reports/**', ' build/test-results/**' // all-contributor bot adds non-indented code
targetExclude 'CONTRIBUTORS.md', 'src/main/scripts/container/README.md', 'build/container/README.md', ' build/reports/**', ' build/test-results/**', 'out/**/*' // all-contributor bot adds non-indented code
trimTrailingWhitespace()
indentWithTabs(4) // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
Expand Down Expand Up @@ -211,21 +211,6 @@ task createChecksum(type: Checksum) {
algorithm = Checksum.Algorithm.SHA256
}

task homebrew(type: Copy) {
dependsOn(createChecksum)
inputs.property('version', project.version)
from('src/main/scripts/brew/jbang.rb')
into(buildDir.toString() + '/brew/formula')
doFirst { t ->
t.filter(org.apache.tools.ant.filters.ReplaceTokens,
tokens: [
projectVersion: project.version,
sha256 : new File(distZip.archiveFile.asFile.get().absolutePath + '.sha256').text
]
)
}
}

task container(type: Copy) {
dependsOn(createChecksum)
inputs.property('version', project.version)
Expand Down Expand Up @@ -257,36 +242,6 @@ task spec(type: Copy) {
}
}

task scoop(type: Copy) {
dependsOn(createChecksum)
inputs.property('version', project.version)
from('src/main/scripts/scoop/jbang.json')
into(buildDir.toString() + '/scoop')
doFirst { t ->
t.filter(org.apache.tools.ant.filters.ReplaceTokens,
tokens: [
projectVersion: project.version,
sha256 : new File(distZip.archiveFile.asFile.get().absolutePath + '.sha256').text
]
)
}
}

task snap(type: Copy) {
dependsOn(createChecksum)
inputs.property('version', project.version)
from('src/main/scripts/snap/snapcraft.yaml')
into(buildDir.toString() + '/snap')
doFirst { t ->
t.filter(org.apache.tools.ant.filters.ReplaceTokens,
tokens: [
projectVersion: project.version,
sha256 : new File(distZip.archiveFile.asFile.get().absolutePath + '.sha256').text
]
)
}
}

task chocolatey(type: Copy) {
dependsOn(createChecksum)
inputs.property('version', project.version)
Expand Down Expand Up @@ -314,24 +269,6 @@ task tag(type: Exec) {
}
}

githubRelease {
// currently does not work as project.version not set.
// FilenameFilter filter = { dir, filename -> filename.contains(project.version) } // ensure nothing extra gets included.
//releaseAssets = distZip.destinationDir.listFiles filter
releaseAssets = files(distZip.destinationDir.listFiles(), new File(project.getBuildDir(), "tmp/version.txt"))
//println(getReleaseAssets().getFiles())
// set ORG_GRADLE_PROJECT_github_token
token = project.hasProperty('github_token') ? getProperty('github_token') : "unknown_github_token"
owner = "jbangdev"
targetCommitish = "main"
draft = true
try {
body = grgit.resolve.toTag(project.version).fullMessage
} catch (Exception e) {
body = "No tag description found for " + project.version
}
}

versioner {
startFrom {
major = 0
Expand Down Expand Up @@ -361,12 +298,9 @@ build.dependsOn(versionTxt)
build.dependsOn(latestDistZip)
build.dependsOn(latestDistTar)
build.dependsOn(copyITests)
build.dependsOn(homebrew)
build.dependsOn(chocolatey)
build.dependsOn(scoop)
build.dependsOn(container)
build.dependsOn(spec)
build.dependsOn(snap)

group = "dev.jbang"
sourceCompatibility = '8'
Expand Down
119 changes: 119 additions & 0 deletions jreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
project:
name: jbang
description: Unleash the power of Java
longDescription: |
Unleash the power of Java.
Use `jbang` to run java, jar, jsh or kt file(s) with automatic dependency fetching
and immediate compilation and execution.
website: https://jbang.dev
docsUrl: https://jbang.dev/documentation
authors:
- Max Rydahl Andersen
license: MIT
tags:
- jbang
- bash
- java
- shell
- scripting
java:
groupId: dev.jbang
version: 8
extraProperties:
inceptionYear: 2020

release:
github:
overwrite: true
draft: true
sign: true
releaseName: '{{tagName}}'
milestone:
close: false
changelog:
formatted: always
change: '- {{commitShortHash}} {{commitTitle}}'
labelers:
- label: 'fix'
title: 'fix:'
- label: 'feature'
title: 'feat:'
- label: 'task'
title: 'chore:'
- label: 'dependencies'
title: 'chore(deps):'
- label: 'test'
title: 'test:'
- label: 'docs'
title: 'docs:'
- label: 'docs'
title: 'doc:'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '🐛 Fixes'
labels:
- 'fix'
- title: '🧰 Tasks'
labels:
- 'task'
- title: '✅ Tests'
labels:
- 'test'
- title: '📝 Documentation'
labels:
- 'docs'
- title: '⚙️ Dependencies'
labels:
- 'dependencies'
replacers:
- search: 'fix: '
- search: 'feat: '
- search: 'chore: '
- search: 'chore\(deps\): '
- search: 'test: '
- search: 'docs: '
- search: 'doc: '

checksum:
individual: true

signing:
active: always
armored: true

announce:
twitter:
active: release
sdkman:
active: release

files:
artifacts:
- path: build/tmp/version.txt
- path: build/distributions/jbang.zip
- path: build/distributions/jbang.tar

distributions:
jbang:
brew:
active: release
extraProperties:
skipJava: true
scoop:
active: release
bucket:
name: 'scoop-bucket'
chocolatey:
active: release
remoteBuild: true
snap:
active: release
remoteBuild: true
base: core18
confinement: classic
artifacts:
- path: build/distributions/jbang-{{projectVersion}}.zip
- path: build/distributions/jbang-{{projectVersion}}.tar
33 changes: 0 additions & 33 deletions misc/updatebrew.sh

This file was deleted.

34 changes: 0 additions & 34 deletions misc/updatescoop.sh

This file was deleted.

15 changes: 15 additions & 0 deletions src/jreleaser/distributions/jbang/brew/README.md.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Homebrew Formulae

## How do I install these formulae?
`brew install {{repoOwner}}/tap/{{distributionName}}`

Or `brew tap {{repoOwner}}/{{distributionName}}` and then `brew install {{distributionName}}`.

Or install via URL (which will not receive updates):

```
brew install https://raw.githubusercontent.com/{{repoOwner}}/homebrew-tap/master/Formula/{{distributionName}}.rb
```

## Documentation
`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).
25 changes: 25 additions & 0 deletions src/jreleaser/distributions/jbang/brew/formula.rb.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class {{brewFormulaName}} < Formula
desc "{{projectDescription}}"
homepage "{{projectWebsite}}"
version "{{projectVersion}}"
url "{{distributionUrl}}"
sha256 "{{distributionSha256}}"
license "{{projectLicense}}"

bottle :unneeded

{{#brewDependencies}}
depends_on {{.}}
{{/brewDependencies}}

def install
libexec.install Dir["*"]
inreplace "#{libexec}/bin/{{distributionExecutable}}", /^abs_jbang_dir=.*/, "abs_jbang_dir=#{libexec}/bin/jbang.jar"
bin.install_symlink "#{libexec}/bin/{{distributionExecutable}}"
end

test do
system "#{bin}/{{distributionExecutable}}", "--init=cli", "hello.java"
system "#{bin}/{{distributionExecutable}}", "hello.java", "Homebrew!"
end
end
1 change: 1 addition & 0 deletions src/jreleaser/distributions/jbang/snap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.snap
Loading

0 comments on commit 31b2800

Please sign in to comment.