Skip to content

Commit

Permalink
👷 homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Nov 3, 2023
1 parent 11e5f6e commit 4ad7f27
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/jreleaser/brew/README.md.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# {{projectName}} Homebrew Tap

## How do I install these formulae?

`brew install ebullient/tap/{{projectName}}`

Or `brew tap ebullient/tap` and then `brew install {{projectName}}`.

## Homebrew Documentation

`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).

## TTRPG convert CLI Documentation

`ttrpg-convert-cli --help` or check [TTRPG Convert CLI Documentation](https://github.com/ebullient/ttrpg-convert-cli/)
43 changes: 43 additions & 0 deletions .github/jreleaser/brew/formula.rb.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# {{jreleaserCreationStamp}}
class {{brewFormulaName}} < Formula
desc "{{projectDescription}}"
homepage "{{projectLinkHomepage}}"
url "{{distributionUrl}}", :using => :nounzip
version "{{projectVersion}}"
sha256 "{{distributionChecksumSha256}}"
license "{{projectLicense}}"

{{#brewHasLivecheck}}
livecheck do
{{#brewLivecheck}}
{{.}}
{{/brewLivecheck}}
end
{{/brewHasLivecheck}}
{{#brewDependencies}}
depends_on {{.}}
{{/brewDependencies}}

def install
libexec.install "{{distributionArtifactFile}}"

bin.mkpath
File.open("#{bin}/{{projectName}}", "w") do |f|
f.write <<~EOS
#!/bin/bash
export JAVA_HOME="#{Language::Java.overridable_java_home_env(nil)[:JAVA_HOME]}"
{{#distributionJavaMainModule}}
exec "${JAVA_HOME}/bin/java" -p #{libexec}/{{distributionArtifactFile}} -m {{distributionJavaMainModule}}/{{distributionJavaMainClass}} "$@"
{{/distributionJavaMainModule}}
{{^distributionJavaMainModule}}
exec "${JAVA_HOME}/bin/java" -jar #{libexec}/{{distributionArtifactFile}} "$@"
{{/distributionJavaMainModule}}
EOS
end
end

test do
output = shell_output("#{bin}/{{projectName}} --version")
assert_match "{{projectVersion}}", output
end
end
10 changes: 9 additions & 1 deletion jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ project:
stereotype: CLI
java:
groupId: dev.ebullient
version: 11
version: 17
multiProject: false
tags:
- "quarkus"
- "cli"
- "5e-tools"
- "pf2e-tools"
- "ttrpg"
- "java"
- "obsidian-md"

Expand Down Expand Up @@ -64,6 +65,13 @@ distributions:
type: SINGLE_JAR
artifacts:
- path: '{{uberJarDir}}/{{projectName}}-{{projectVersion}}-runner.jar'
brew:
active: ALWAYS
continueOnError: true
formulaName: 'ttrpg-convert-cli'
templateDirectory: .github/jreleaser/brew
repository:
commitMessage: '{{projectName}} {{tagName}}'

native-archive:
type: NATIVE_IMAGE
Expand Down

0 comments on commit 4ad7f27

Please sign in to comment.