-
Notifications
You must be signed in to change notification settings - Fork 160
[feature] Add brew cask install option #322
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,83 @@ | ||
| name: Update Cask on Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| update-cask: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| if: startsWith(github.event.release.tag_name, 'v') && endsWith(github.event.release.tag_name, '-tauri') | ||
| steps: | ||
| - name: Checkout tap repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract version from tag | ||
| id: version | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| VERSION="${TAG#v}" | ||
| VERSION="${VERSION%-tauri}" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "Detected version: $VERSION" | ||
|
|
||
| - name: Fetch release assets SHA256 | ||
| id: sha256 | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| VERSION="${{ steps.version.outputs.version }}" | ||
| REPO="${{ github.repository }}" | ||
|
|
||
| # Fetch release assets info | ||
| RESPONSE=$(gh api "repos/$REPO/releases/tags/v${VERSION}-tauri") | ||
|
|
||
| # Extract SHA256 for aarch64 DMG | ||
| ARM64_SHA=$(echo "$RESPONSE" | jq -r '.assets[] | select(.name | contains("aarch64.dmg")) | .digest' | sed 's/sha256://') | ||
|
|
||
| # Extract SHA256 for x64 DMG | ||
| X64_SHA=$(echo "$RESPONSE" | jq -r '.assets[] | select(.name | contains("_x64.dmg")) | .digest' | sed 's/sha256://') | ||
|
Kiruno-lz marked this conversation as resolved.
|
||
|
|
||
| echo "arm64_sha=$ARM64_SHA" >> "$GITHUB_OUTPUT" | ||
| echo "x64_sha=$X64_SHA" >> "$GITHUB_OUTPUT" | ||
|
|
||
| echo "aarch64 DMG SHA256: $ARM64_SHA" | ||
| echo "x64 DMG SHA256: $X64_SHA" | ||
|
|
||
| - name: Update Cask file | ||
| run: | | ||
| VERSION="${{ steps.version.outputs.version }}" | ||
| ARM64_SHA="${{ steps.sha256.outputs.arm64_sha }}" | ||
| X64_SHA="${{ steps.sha256.outputs.x64_sha }}" | ||
| CASK_FILE="Casks/openless.rb" | ||
|
|
||
| # Update version | ||
| sed -i "s/version \"[^\"]*\"/version \"$VERSION\"/" "$CASK_FILE" | ||
|
|
||
| # Update SHA256 values | ||
| sed -i "s/sha256 arm: \"[^\"]*\"/sha256 arm: \"$ARM64_SHA\"/" "$CASK_FILE" | ||
| sed -i "s/intel: \"[^\"]*\"/intel: \"$X64_SHA\"/" "$CASK_FILE" | ||
|
|
||
| echo "Updated $CASK_FILE:" | ||
| cat "$CASK_FILE" | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --local user.name "github-actions[bot]" | ||
|
|
||
| VERSION="${{ steps.version.outputs.version }}" | ||
|
|
||
| git add Casks/openless.rb | ||
|
|
||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| fi | ||
|
|
||
| git commit -m "[cask] Update openless to $VERSION" | ||
| git push | ||
This file contains hidden or 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,29 @@ | ||
| cask "openless" do | ||
| arch arm: "aarch64", intel: "x64" | ||
|
|
||
| version "1.2.22" | ||
| sha256 arm: "8e65729eb671f5fec3ce392d4f8dfd33303f1c84f8f4533683f8d3a3afd1e21d", | ||
| intel: "6d97fb7cab173b4f3241aa18b3db0f51a03a03d6b2bdea48cab8fe761440df7b" | ||
|
|
||
| url "https://github.com/appergb/openless/releases/download/v#{version}-tauri/OpenLess_#{version}_#{arch}.dmg" | ||
| name "OpenLess" | ||
| desc "Menu-bar voice input layer for macOS" | ||
| homepage "https://github.com/appergb/openless" | ||
|
|
||
| livecheck do | ||
| url :url | ||
| regex(/^v?(\d+(?:\.\d+)+)[._-]tauri$/i) | ||
| end | ||
|
|
||
| auto_updates true | ||
|
|
||
| app "OpenLess.app" | ||
|
|
||
| zap trash: [ | ||
| "~/Library/Application Support/OpenLess", | ||
| "~/Library/Caches/com.openless.app", | ||
| "~/Library/Logs/OpenLess", | ||
| "~/Library/Preferences/com.openless.app.plist", | ||
| "~/Library/WebKit/com.openless.app", | ||
| ] | ||
| end |
This file contains hidden or 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,67 @@ | ||
| class Openless < Formula | ||
| desc "Menu-bar voice input layer for macOS" | ||
| homepage "https://github.com/appergb/openless" | ||
| url "https://github.com/appergb/openless/archive/refs/tags/v1.2.20-tauri.tar.gz" | ||
| sha256 "be1363f7762a42b7e932ec3cc687cfdfb5b550b6cf1c96d52a1f87c906f27863" | ||
| license "MIT" | ||
|
|
||
| head "https://github.com/appergb/openless.git", branch: "main" | ||
|
|
||
| depends_on "rust" => :build | ||
| depends_on "node" => :build | ||
| depends_on :macos | ||
| depends_on arch: :arm64 | ||
|
|
||
| # qwen-asr submodule for local ASR engine on macOS | ||
| resource "qwen-asr" do | ||
| url "https://github.com/antirez/qwen-asr.git", | ||
| revision: "b00b789b17051aea61e9717458171100662318a4" | ||
| end | ||
|
|
||
| def install | ||
| # Place submodule at expected path before building | ||
| vendor_dir = "openless-all/app/src-tauri/vendor/qwen-asr" | ||
| rm_rf vendor_dir | ||
| resource("qwen-asr").stage(vendor_dir) | ||
|
|
||
| cd "openless-all/app" do | ||
| # Install frontend dependencies | ||
| system "npm", "ci" | ||
|
|
||
| # Build Tauri app with ad-hoc signing (no Developer ID required) | ||
| ENV["APPLE_SIGNING_IDENTITY"] = "-" | ||
| system "npm", "run", "tauri", "--", "build" | ||
|
|
||
| # Install the .app bundle | ||
| prefix.install "src-tauri/target/release/bundle/macos/OpenLess.app" | ||
| end | ||
|
|
||
| # Symlink binary for command-line access | ||
| bin.install_symlink prefix/"OpenLess.app/Contents/MacOS/openless" | ||
| end | ||
|
|
||
| def caveats | ||
| <<~EOS | ||
| OpenLess.app has been installed to: | ||
| #{prefix}/OpenLess.app | ||
|
|
||
| To use it, link it into /Applications: | ||
| ln -sf #{opt_prefix}/OpenLess.app /Applications/OpenLess.app | ||
|
|
||
| Or launch it directly: | ||
| open #{opt_prefix}/OpenLess.app | ||
|
|
||
| First-time setup: | ||
| - Grant Accessibility permission when prompted | ||
| - Grant Microphone permission when prompted | ||
|
|
||
| If Gatekeeper blocks the app (ad-hoc signed), run: | ||
| xattr -cr /Applications/OpenLess.app | ||
| EOS | ||
| end | ||
|
|
||
| test do | ||
| assert_path_exists prefix/"OpenLess.app" | ||
| assert_predicate prefix/"OpenLess.app/Contents/MacOS/openless", :executable? | ||
| end | ||
| end |
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this workflow runs from
release.published, GitHub documentsGITHUB_REFas the release tag (refs/tags/<tag_name>), andactions/checkoutdefaults to the event ref; this leaves the job on a detached tag checkout. The latergit commitsucceeds, butgit pushwithout a refspec then fails with “You are not currently on a branch”, so every release that needs a cask checksum bump will leaveCasks/openless.rbstale unless the checkout targets the tap branch (or the push uses an explicitHEAD:<branch>refspec).Useful? React with 👍 / 👎.