Skip to content

Commit

Permalink
Add Homebrew release to GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kdambekalns committed Sep 29, 2020
1 parent d7ca065 commit 4bf7570
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/go.build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,63 @@ jobs:
asset_path: beach_darwin_amd64.zip
asset_name: beach_darwin_amd64.zip
asset_content_type: application/zip

- name: Calculate checksums
id: calculate-checksums
run: |
echo "::set-output name=darwin_sha256sum::$(sha256sum beach_darwin_amd64.zip)"
echo "::set-output name=linux_sha256sum::$(sha256sum beach_linux_amd64.zip)"
homebrew:
name: Homebrew release
runs-on: ubuntu-latest
needs: build
steps:

- name: Check out Homebrew code
uses: actions/checkout@v2
with:
repository: flownative/homebrew-flownative
path: homebrew

- name: Copy file
uses: canastro/[email protected]
with:
source: .github/workflows/localbeach.rb.tpl
target: homebrew/Formula/localbeach.rb

- name: Replace version number
uses: shitiomatic/str-replace@master
with:
find: "{{version}}"
replace: ${{ github.ref }}
include: homebrew/Formula/localbeach.rb

- name: Replace SHA256 sum (darwin)
uses: shitiomatic/str-replace@master
with:
find: "{{{darwin_sha256sum}}"
replace: ${{needs.build.outputs.darwin_sha256sum}}
include: homebrew/Formula/localbeach.rb

- name: Replace SHA256 sum (linux)
uses: shitiomatic/str-replace@master
with:
find: "{{linux_sha256sum}}"
replace: ${{needs.build.outputs.linux_sha256sum}}
include: homebrew/Formula/localbeach.rb

- name: Commit update
uses: EndBug/add-and-commit@v5
with:
add: 'homebrew'
branch: master
cwd: './homebrew'
message: 'localbeach: update to ${{ github.ref }}'

- name: Push to git
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: flownative/homebrew-flownative
directory: homebrew
30 changes: 30 additions & 0 deletions .github/workflows/localbeach.rb.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

#
# DO NOT EDIT THIS FILE MANUALLY
#
class Localbeach < Formula
desc "Command-line tool for Flownative Beach"
homepage "https://www.flownative.com/beach"
license "GPL-3.0-or-later"
version "{{version}}"

if RUBY_PLATFORM.downcase.include?("darwin")
url "https://github.com/flownative/localbeach/releases/download/{{version}}/beach_darwin_amd64.zip"
sha256 "{{darwin_sha256sum}}"
else
url "https://github.com/flownative/localbeach/releases/download/{{version}}/beach_linux_amd64.zip"
sha256 "{{linux_sha256sum}}"
end

bottle :unneeded

conflicts_with "flownative/flownative/beach-cli", because: "localbeach replaces beach-cli"

def install
database_path = RUBY_PLATFORM.downcase.include?("darwin") ? "~/Library/Application Support/Flownative/Local Beach/MariaDB" : "~/.Flownative/Local Beach/MariaDB"

bin.install "beach" => "beach"
system "#{bin}/beach", "setup", "--docker-folder", "#{lib}/localbeach", "--database-folder", database_path
end
end

0 comments on commit 4bf7570

Please sign in to comment.