-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from comboomPunkTsucht/dev
make it homebrew installation
- Loading branch information
Showing
3 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Submit Homebrew Formula | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
submit-formula: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download macOS release | ||
run: | | ||
wget https://github.com/comboomPunkTsucht/genp/releases/download/${{ github.event.release.tag_name }}/genp-universal-apple-darwin.tar.gz -O genp-mac.tar.gz | ||
- name: Download Linux release | ||
run: | | ||
wget https://github.com/comboomPunkTsucht/genp/releases/download/${{ github.event.release.tag_name }}/genp-x86_64-unknown-linux-gnu.tar.gz -O genp-linux.tar.gz | ||
- name: Calculate macOS checksum | ||
id: macos_checksum | ||
run: | | ||
echo "sha256=$(shasum -a 256 genp-mac.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV | ||
- name: Calculate Linux checksum | ||
id: linux_checksum | ||
run: | | ||
echo "sha256_linux=$(shasum -a 256 genp-linux.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV | ||
- name: Generate Homebrew Formula | ||
run: | | ||
mkdir -p homebrew-core/Formula | ||
cat <<EOF > homebrew-core/Formula/genp.rb | ||
class Genp < Formula | ||
desc "A CLI tool for generating passwords and PINs" | ||
homepage "https://github.com/comboomPunkTsucht/genp" | ||
version "${{ github.event.release.tag_name }}" | ||
on_macos do | ||
url "https://github.com/comboomPunkTsucht/genp/releases/download/${{ github.event.release.tag_name }}/genp-universal-apple-darwin.tar.gz" | ||
sha256 "${{ env.sha256 }}" | ||
def install | ||
bin.install "genp" | ||
end | ||
end | ||
on_linux do | ||
url "https://github.com/comboomPunkTsucht/genp/releases/download/${{ github.event.release.tag_name }}/genp-x86_64-unknown-linux-gnu.tar.gz" | ||
sha256 "${{ env.sha256_linux }}" | ||
def install | ||
bin.install "genp" | ||
end | ||
end | ||
test do | ||
system "#{bin}/genp", "--version" | ||
end | ||
end | ||
EOF | ||
- name: Install Homebrew | ||
run: | | ||
git clone https://github.com/Homebrew/homebrew-core.git | ||
cd homebrew-core | ||
brew tap-new user/homebrew-tap | ||
brew tap user/homebrew-tap | ||
- name: Test Formula on macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
cd homebrew-core | ||
brew install --build-from-source ./Formula/genp.rb | ||
- name: Test Formula on Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
cd homebrew-core | ||
brew install --build-from-source ./Formula/genp.rb | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
base: master | ||
branch: homebrew-genp | ||
title: "Add genp formula" | ||
body: | | ||
This pull request adds a Homebrew formula for the `genp` package, supporting both macOS and Linux. | ||
commit-message: "Add genp formula" | ||
|
||
- name: Cleanup | ||
run: | | ||
rm -rf homebrew-core |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters