diff --git a/.github/workflows/homebrew-verify.yml b/.github/workflows/homebrew-verify.yml new file mode 100644 index 0000000..089ca87 --- /dev/null +++ b/.github/workflows/homebrew-verify.yml @@ -0,0 +1,27 @@ +name: verify homebrew formula + +on: + pull_request: + branches: [ "main", "development" ] + paths: + - 'pkg/homebrew/Formula/quickmark-cli.rb' + +jobs: + verify_formula: + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create local tap + run: | + brew tap-new local/quickmark-test + + - name: Copy formula to tap + run: | + cp pkg/homebrew/Formula/quickmark-cli.rb $(brew --repo local/quickmark-test)/Formula/ + + - name: Install formula from source + run: | + brew install --build-from-source local/quickmark-test/quickmark-cli diff --git a/pkg/homebrew/Formula/quickmark-cli.rb b/pkg/homebrew/Formula/quickmark-cli.rb index b4960dd..d5486fd 100644 --- a/pkg/homebrew/Formula/quickmark-cli.rb +++ b/pkg/homebrew/Formula/quickmark-cli.rb @@ -7,13 +7,17 @@ class QuickmarkCli < Formula on_macos do if Hardware::CPU.intel? url "https://github.com/ekropotin/quickmark/releases/download/quickmark-cli%40#{version}/qmark-x86_64-apple-darwin.tar.gz" - sha256 "sha256:90740f9c0632d8b1da4d00c9c6361c01eb9a72c074641f6952723e6583bbdd8d" + sha256 "90740f9c0632d8b1da4d00c9c6361c01eb9a72c074641f6952723e6583bbdd8d" else url "https://github.com/ekropotin/quickmark/releases/download/quickmark-cli%40#{version}/qmark-aarch64-apple-darwin.tar.gz" - sha256 "sha256:4466f54fd304d34d21dba7871a09d4d24df6c23f7cee48fae1f4a6a1f5466855" + sha256 "4466f54fd304d34d21dba7871a09d4d24df6c23f7cee48fae1f4a6a1f5466855" end end + def install + bin.install "qmark" + end + test do # Create a test markdown file (testpath/"test.md").write("# Test\n\nThis is a test.") diff --git a/pkg/homebrew/README.md b/pkg/homebrew/README.md index b709e9d..a641060 100644 --- a/pkg/homebrew/README.md +++ b/pkg/homebrew/README.md @@ -30,7 +30,7 @@ qmark --config quickmark.toml *.md ## Formula Details - **Location**: `Formula/quickmark-cli.rb` -- **Binary name**: `qmark` +- **Binary name**: `qmark` - **Architecture support**: Intel and Apple Silicon Macs - **Installation method**: Pre-compiled binaries from GitHub releases @@ -43,6 +43,14 @@ When releasing a new version: 3. Test the formula: `brew install --build-from-source ./Formula/quickmark-cli.rb` 4. Commit and push the changes +### Testing changes locally + +```bash +brew tap-new local/quickmark-test +cp pkg/homebrew/Formula/quickmark-cli.rb $(brew --repo local/quickmark-test)/Formula/ +brew install --build-from-source local/quickmark-test/quickmark-cli +``` + ## Updating ```bash @@ -55,4 +63,4 @@ brew upgrade quickmark-cli ```bash brew uninstall quickmark-cli brew untap ekropotin/quickmark -``` \ No newline at end of file +```