Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew #39

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Homebrew #39

wants to merge 6 commits into from

Conversation

Jomy10
Copy link

@Jomy10 Jomy10 commented Jan 17, 2022

I have added Homebrew support.

Instructions for building:

In /scripts/homebrew

./build_homebrew.sh

This script will build the app with cargo and copy it to app/epick.app. Afterwards, epick.app is archived to a .tar.gz.

The epick.app.tar.gz must then be uploaded somewhere so it can be downloaded, like to GitHub's Releases. When uploaded, copy the link to the file and run

VERSION={CURRENT_VERSION} URL="{URL}" ./build_cask.sh > path/to/Casks/epick.rb

Where CURRENT_VERSION is the current version of the app (e.g. 0.6.1) and URL is the url of the .tar.gz file.

Now you will need a repo called homebrew-epick. You can copy mine: https://github.com/Jomy10/homebrew-epick.

Lastly: replace path/to/Casks/epick.rb with the path to your local copy of the epick.rb of the homebrew-epick repo.

Now just commit & push to GitHub and you should be able to install epick from Homebrew:

brew tap vv9k/epick && brew install --cask epick

@Jomy10
Copy link
Author

Jomy10 commented Jan 17, 2022

Linked issue: #23

@Jomy10
Copy link
Author

Jomy10 commented Jan 17, 2022

Forgot to mention as well, we can add the cask to the Homebrew repo. I haven't tried this out, but I can look into it, if this is good?

Just noticed this test file is still here.
@vv9k
Copy link
Owner

vv9k commented Jan 18, 2022

Thanks for the PR! Awesome work :) Will test it out on my mac later when I get some time.

Forgot to mention as well, we can add the cask to the Homebrew repo. I haven't tried this out, but I can look into it, if this is good?

Sounds good to me!

I just have one question, does the archive epick.app.tar.gz have to be commited in? And what is the content of this archive? Perhaps it would be better to add it to .gitignore along with all generated icons if they are not necessary to be present in the repo for the cask to work. I don't have prior experience with creating new homebrew formulae but from what I remember it usually used to be just one ruby file called formulae that would contain the whole build description. Has anything changed since then?

@Jomy10
Copy link
Author

Jomy10 commented Jan 18, 2022

The epick.app.tar.gz and all the generated icons doesn't need to be in the repo for homebrew to work. The archive only needs to be uploaded somewhere (like GitHub Releases). The content of this file is just the epick.app located in scripts/homebrew/app, which is essentially just a wrapper around the executable file generated by the rust compiler (with some necessary config files and the app icon).

I don't have prior experience with creating new homebrew formulae but from what I remember it usually used to be just one ruby file called formulae that would contain the whole build description. Has anything changed since then?

Yup, that single ruby file (located in my homebrew-epick repo) is what the VERSION={CURRENT_VERSION} URL="{URL}" ./build_cask.sh > path/to/Casks/epick.rb command generates. But, since we are dealing with a GUI application, we can't use a formulae (those are for CLI's), but instead a Cask. They are pretty similar.

I'll look into adding the app to the Homebrew repo once you have uploaded the archive file. Let me know if you have any further questions.

@vv9k
Copy link
Owner

vv9k commented Feb 4, 2022

Sorry for my late answer, I've been pretty busy lately.

I was wondering that perhaps it would be better to assemble this archive with all the icons during the CI release build so that it's added along with all other release archives. Would you be willing to update the current CI to include the archive? I'm not sure what are the instructions to create it. It would have to be added somewhere here:

build_and_upload_artifacts:
name: Upload Artifacts
needs: [test]
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, windows-msvc]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux
- build: windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
- build: macos
os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Set up Rust
uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@master
- name: Set version
id: set_version
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "::set-output name=EPICK_VERSION::${GITHUB_REF#refs/tags/}"
- name: Set version
id: set_version_win
if: matrix.os == 'windows-latest'
run: echo "::set-output name=EPICK_VERSION::$(git describe --tags --abbrev=0)"
- name: Set archive name
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
id: set_name
run: echo "::set-output name=EPICK_ARCHIVE::epick-${{ steps.set_version.outputs.EPICK_VERSION}}-${{ matrix.target}}"
- name: Set archive name
if: matrix.os == 'windows-latest'
id: set_name_win
run: echo "::set-output name=EPICK_ARCHIVE::epick-${{steps.set_version_win.outputs.EPICK_VERSION}}-${{ matrix.target}}"
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- run: cargo build --release
name: Release build
- name: Prepare archive directory
run: mkdir epick
- name: Move release files
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
mv target/release/epick epick/
- name: Move release files
if: matrix.os == 'windows-latest'
run: |
mv target/release/epick.exe epick/
- name: Move other files
run: |
mv README.md epick/
mv LICENSE epick/
- name: Create archives
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
tar -zcvf ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.gz epick
tar -Jcvf ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.xz epick
- name: Create archives
if: matrix.os == 'windows-latest'
run: |
7z a ${{ steps.set_name_win.outputs.EPICK_ARCHIVE }}.zip epick
- name: Upload gz
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_name: wojciechkepka/epick
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.gz
asset_name: ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.gz
tag: ${{ steps.set_version.outputs.EPICK_VERSION }}
overwrite: true
- name: Upload xz
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_name: wojciechkepka/epick
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.xz
asset_name: ${{ steps.set_name.outputs.EPICK_ARCHIVE }}.tar.xz
tag: ${{ steps.set_version.outputs.EPICK_VERSION }}
overwrite: true
- name: Upload zip
if: matrix.os == 'windows-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_name: wojciechkepka/epick
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.set_name_win.outputs.EPICK_ARCHIVE }}.zip
asset_name: ${{ steps.set_name_win.outputs.EPICK_ARCHIVE }}.zip
tag: ${{ steps.set_version_win.outputs.EPICK_VERSION }}
overwrite: true

@Jomy10
Copy link
Author

Jomy10 commented Feb 5, 2022

Hi. No problem.

I haven’t used CI too much, but I’ll try to implement this!

@vv9k vv9k force-pushed the master branch 3 times, most recently from e9f0304 to ffd4d20 Compare August 2, 2022 17:18
@vv9k vv9k force-pushed the master branch 5 times, most recently from b6c3088 to 1997b2f Compare September 1, 2022 06:57
@vv9k vv9k force-pushed the master branch 8 times, most recently from c8fc9cf to a34fee2 Compare October 21, 2022 05:43
@vv9k vv9k force-pushed the master branch 4 times, most recently from c4a51a5 to 14ee92e Compare October 21, 2022 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants