feature/sdk-workflows
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | name: Homebrew CLI Release |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | inputs: |
| 6 | tag: |
| 7 | description: "Release tag (e.g. v0.3.39)" |
| 8 | required: true |
| 9 | |
| 10 | permissions: |
| 11 | contents: read |
| 12 | |
| 13 | env: |
| 14 | REPO: smbcloudXYZ/smbcloud-cli |
| 15 | |
| 16 | jobs: |
| 17 | update-homebrew-tap: |
| 18 | name: Update Homebrew tap |
| 19 | runs-on: ubuntu-latest |
| 20 | |
| 21 | steps: |
| 22 | - name: Resolve tag and version |
| 23 | id: release |
| 24 | shell: bash |
| 25 | run: | |
| 26 | TAG="${{ github.event.inputs.tag }}" |
| 27 | VERSION="${TAG#v}" |
| 28 | |
| 29 | echo "tag=${TAG}" >> "$GITHUB_OUTPUT" |
| 30 | echo "version=${VERSION}" >> "$GITHUB_OUTPUT" |
| 31 | |
| 32 | - name: Read SHA256 checksums from release |
| 33 | id: sha |
| 34 | env: |
| 35 | GH_TOKEN: ${{ github.token }} |
| 36 | shell: bash |
| 37 | run: | |
| 38 | mkdir -p artifacts |
| 39 | |
| 40 | for attempt in 1 2 3 4 5; do |
| 41 | if gh release download "${{ steps.release.outputs.tag }}" \ |
| 42 | --repo "${{ env.REPO }}" \ |
| 43 | --pattern "smb-macos-*.tar.gz.sha256" \ |
| 44 | --dir artifacts/; then |
| 45 | break |
| 46 | fi |
| 47 | |
| 48 | if [ "$attempt" -eq 5 ]; then |
| 49 | echo "Failed to download Homebrew checksum artifacts from the GitHub release." >&2 |
| 50 | exit 1 |
| 51 | fi |
| 52 | |
| 53 | echo "Release assets not visible yet. Retrying in 10 seconds..." |
| 54 | sleep 10 |
| 55 | done |
| 56 | |
| 57 | ARM64_SHA=$(cat artifacts/smb-macos-arm64.tar.gz.sha256) |
| 58 | AMD64_SHA=$(cat artifacts/smb-macos-amd64.tar.gz.sha256) |
| 59 | |
| 60 | echo "arm64=${ARM64_SHA}" >> "$GITHUB_OUTPUT" |
| 61 | echo "amd64=${AMD64_SHA}" >> "$GITHUB_OUTPUT" |
| 62 | |
| 63 | echo "ARM64 SHA256: ${ARM64_SHA}" |
| 64 | echo "AMD64 SHA256: ${AMD64_SHA}" |
| 65 | |
| 66 | - name: Checkout Homebrew tap |
| 67 | uses: actions/checkout@v6 |
| 68 | with: |
| 69 | repository: smbcloudXYZ/homebrew-tap |
| 70 | token: ${{ secrets.HOMEBREW_TAP_TOKEN }} |
| 71 | path: homebrew-tap |
| 72 | |
| 73 | - name: Generate formula |
| 74 | shell: bash |
| 75 | run: | |
| 76 | VERSION="${{ steps.release.outputs.version }}" |
| 77 | TAG="${{ steps.release.outputs.tag }}" |
| 78 | ARM64_SHA="${{ steps.sha.outputs.arm64 }}" |
| 79 | AMD64_SHA="${{ steps.sha.outputs.amd64 }}" |
| 80 | |
| 81 | mkdir -p homebrew-tap/Formula |
| 82 | |
| 83 | cat > homebrew-tap/Formula/cli.rb <<FORMULA |
| 84 | # frozen_string_literal: true |
| 85 | |
| 86 | # Homebrew formula for the smbCloud CLI (\`smb\` binary). |
| 87 | class Cli < Formula |
| 88 | desc 'smbCloud command line interface' |
| 89 | homepage 'https://github.com/${REPO}' |
| 90 | version '${VERSION}' |
| 91 | license 'Apache-2.0' |
| 92 | |
| 93 | on_macos do |
| 94 | on_arm do |
| 95 | url 'https://github.com/${REPO}/releases/download/${TAG}/smb-macos-arm64.tar.gz' |
| 96 | sha256 '${ARM64_SHA}' |
| 97 | end |
| 98 | on_intel do |
| 99 | url 'https://github.com/${REPO}/releases/download/${TAG}/smb-macos-amd64.tar.gz' |
| 100 | sha256 '${AMD64_SHA}' |
| 101 | end |
| 102 | end |
| 103 | |
| 104 | def install |
| 105 | bin.install 'smb' |
| 106 | end |
| 107 | |
| 108 | test do |
| 109 | system "#{bin}/smb", '--help' |
| 110 | end |
| 111 | end |
| 112 | FORMULA |
| 113 | |
| 114 | echo "Generated formula:" |
| 115 | cat homebrew-tap/Formula/cli.rb |
| 116 | |
| 117 | - name: Commit and push |
| 118 | shell: bash |
| 119 | run: | |
| 120 | VERSION="${{ steps.release.outputs.version }}" |
| 121 | |
| 122 | cd homebrew-tap |
| 123 | git config user.name "github-actions[bot]" |
| 124 | git config user.email "github-actions[bot]@users.noreply.github.com" |
| 125 | git add Formula/cli.rb |
| 126 | git diff --cached --quiet && echo "No changes to commit" && exit 0 |
| 127 | git commit -m "Update smb to ${VERSION}" |
| 128 | git push |