Skip to content

Commit

Permalink
Merge pull request #2 from comboomPunkTsucht/dev
Browse files Browse the repository at this point in the history
make it homebrew installation
  • Loading branch information
mcpeapsUnterstrichHD authored Sep 4, 2024
2 parents 8ae0108 + fdb9ead commit cc7fe1c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/homebrew.yml
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "genp"
version = "1.0.1"
version = "1.0.2"
description = "A simple Generator for PINs and Passwords"
authors = ["comboom.sucht","mcpeaps_HD"]
edition = "2021"
Expand Down

0 comments on commit cc7fe1c

Please sign in to comment.