From 88da054c3e5324433a1c6a3e9e1b2741adee5a2e Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 23 Jun 2022 12:13:05 +0530 Subject: [PATCH] chore: add step to publish in homebrew Signed-off-by: Pranav C --- .github/workflows/release-executables.yml | 52 ++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-executables.yml b/.github/workflows/release-executables.yml index 3ea939f034..bc97fe601e 100644 --- a/.github/workflows/release-executables.yml +++ b/.github/workflows/release-executables.yml @@ -125,7 +125,7 @@ jobs: retention-days: 1 - publish-mac-executables: + publish-mac-executables-and-homebrew: needs: sign-mac-executables runs-on: ubuntu-latest steps: @@ -134,6 +134,25 @@ jobs: name: ${{ github.event.inputs.tag || inputs.tag }} path: scripts/pkg-executable/mac-dist + + + - uses: actions/checkout@v3 + with: + path: 'homebrew-nocodb' + token: ${{ secrets.NC_GITHUB_TOKEN }} + repository: 'nocodb/homebrew-noco' + fetch-depth: 0 + + - name: Compress files and calculate checksum + run: | + cp ./mac-dist/Noco-macos-x64 ./mac-dist/noco + tar -czf ./mac-dist/noco.tar.gz ./mac-dist/noco + rm ./mac-dist/noco + echo "::set-output name=CHECKSUM::$(shasum -a 256 ./mac-dist/noco.tar.gz | awk '{print $1}')" + id: compress + + + - name: Upload mac executables to release uses: svenstaro/upload-release-action@v2 with: @@ -144,3 +163,34 @@ jobs: file_glob: true + - name: Generate Homebrew Formula class and push + run: | + FORMULA_CLASS_STR=$(cat << EOF + class Noco < Formula + desc "Get Human Readable file size information. - CLI" + homepage "https://github.com/nocodb/nocodb" + url "https://github.com/novcodb/nocodb/releases/download/${{ github.event.inputs.tag || inputs.tag }}/noco.tar.gz" + sha256 "${{ steps.compress.outputs.CHECKSUM }}" + license "MIT" + version "${{ github.event.inputs.tag || inputs.tag }}" + + def install + bin.install "noco" + end + end + EOF + ) + + printf "$FORMULA_CLASS_STR" > homebrew-nocodb/Formula/noco.rb + + cd ./homebrew-nocodb + + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + git commit ./Formula/noco.rb -m "Automatic publish" + git push + + + +