Skip to content

Commit

Permalink
Add CI action to publish wave-cli to homebrew (#37)
Browse files Browse the repository at this point in the history
* formula template added

* brew config added in jreleaser.yml

* refactored brew formula

* refactored brew formula

* add zip artifacts for mac

* changed type from NATIVE_IMAGE to FLAT_BINARY

* minor change

* minor change

* minor change

* token changed

* formula updated

* formula updated

* formula updated

* formula templated finalised

* minor changes

* minor changes

* Formula name changed to wave-cli

* minor change

* template dir renamed to wave-cli
  • Loading branch information
munishchouhan authored Dec 18, 2023
1 parent d70972e commit a25adbd
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 11 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ jobs:
fatjar: true
- os: macos-latest
codesign: true
zip: true
- os: macos-latest-xlarge
codesign: true
zip: true
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -85,7 +87,13 @@ jobs:
ditto -c -k --keepParent "./app/build/native/nativeCompile/wave" "notarization.zip"
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
- name: Upload binary
- name: create zip
if: ${{ matrix.zip }}
run: |
cd ./app/build/native/nativeCompile/
zip wave.zip wave
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: nativeCompile-${{ matrix.os }}
Expand Down Expand Up @@ -128,7 +136,7 @@ jobs:
- name: Run JReleaser
uses: jreleaser/release-action@v2
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.VERSION }}

- name: JReleaser release output
Expand Down
38 changes: 38 additions & 0 deletions app/src/jreleaser/distributions/wave-cli/brew/formula.rb.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# {{jreleaserCreationStamp}}
class {{brewFormulaName}} < Formula
desc "{{projectDescription}}"
homepage "{{projectLinkHomepage}}"
version "{{projectVersion}}"
license "{{projectLicense}}"

if OS.mac? && Hardware::CPU.arm?
url "https://github.com/seqeralabs/wave-cli/releases/download/v{{projectEffectiveVersion}}/wave-{{projectEffectiveVersion}}-macos-arm64.zip"
sha256 "{{distributionChecksumSha256}}"

def install
bin.install "wave" => "wave"
end
end

if OS.mac? && Hardware::CPU.intel?
url "https://github.com/seqeralabs/wave-cli/releases/download/v{{projectEffectiveVersion}}/wave-{{projectEffectiveVersion}}-macos-x86_64.zip"
sha256 "{{distributionChecksumSha256}}"

def install
bin.install "wave" => "wave"
end
end

test do
output = shell_output("#{bin}/wave --version")
assert_match "{{projectVersion}}", output
end

def caveats
<<~EOS
wave cli has been installed!
To run it, type:
wave --help
EOS
end
end
38 changes: 29 additions & 9 deletions jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project:
longDescription: Command line tool for Wave container provisioning
website: https://github.com/seqeralabs/wave-cli
authors:
- Seqera Labs
- Seqera
license: MPL-2.0
extraProperties:
inceptionYear: 2023
Expand Down Expand Up @@ -74,23 +74,43 @@ release:

distributions:
wave-cli:
type: NATIVE_IMAGE
type: FLAT_BINARY
artifacts:
- path: "nativeCompile-ubuntu-latest/wave"
transform: "wave-{{projectEffectiveVersion}}-linux-x86_64"
platform: linux-x86_64
- path: "nativeCompile-macos-latest/wave"
transform: "wave-{{projectEffectiveVersion}}-macos-x86_64"
platform: osx-x86_64
- path: "nativeCompile-macos-latest-xlarge/wave"
transform: "wave-{{projectEffectiveVersion}}-macos-arm64"
platform: osx-arm64
extraProperties:
graalVMNativeImage: true
- path: "nativeCompile-windows-latest/wave.exe"
transform: "wave-{{projectEffectiveVersion}}-windows-x86_64.exe"
platform: windows-x86_64
extraProperties:
graalVMNativeImage: true
- path: "nativeCompile-macos-latest/wave.zip"
transform: "wave-{{projectEffectiveVersion}}-macos-x86_64.zip"
platform: osx-x86_64
extraProperties:
graalVMNativeImage: true
- path: "nativeCompile-macos-latest-xlarge/wave.zip"
transform: "wave-{{projectEffectiveVersion}}-macos-arm64.zip"
platform: osx-aarch_64
extraProperties:
graalVMNativeImage: true

wave-cli-jar:
type: SINGLE_JAR
artifacts:
- path: "wave_jar/wave.jar"
transform: "wave-{{projectEffectiveVersion}}.jar"
transform: "wave-{{projectEffectiveVersion}}.jar"

packagers:
brew:
active: ALWAYS
continueOnError: false
templateDirectory: ./app/src/jreleaser/distributions/wave-cli/brew
repository:
active: RELEASE
tagName: '{{distributionName}}-{{tagName}}'
branch: HEAD
commitMessage: '{{distributionName}} {{tagName}}'

0 comments on commit a25adbd

Please sign in to comment.