Release 0.1.33 #30
Workflow file for this run
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
| name: Homebrew 发布 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| jobs: | |
| update-homebrew-tap: | |
| runs-on: ubuntu-latest | |
| env: | |
| HOMEBREW_TAP_REPOSITORY: iFurySt/homebrew-open-browser-use | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Render and publish Homebrew formula | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if [ -z "${HOMEBREW_TAP_TOKEN}" ]; then | |
| echo "HOMEBREW_TAP_TOKEN is required to update ${HOMEBREW_TAP_REPOSITORY}" >&2 | |
| exit 1 | |
| fi | |
| version="${GITHUB_REF_NAME#v}" | |
| assets_dir="$(mktemp -d)" | |
| required_assets=( | |
| "open-browser-use-cli-${version}-darwin-amd64.tar.gz" | |
| "open-browser-use-cli-${version}-darwin-arm64.tar.gz" | |
| "open-browser-use-cli-${version}-linux-amd64.tar.gz" | |
| "open-browser-use-cli-${version}-linux-arm64.tar.gz" | |
| ) | |
| for attempt in $(seq 1 60); do | |
| rm -f "${assets_dir}"/*.tar.gz | |
| if gh release download "${GITHUB_REF_NAME}" \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --pattern "open-browser-use-cli-${version}-*.tar.gz" \ | |
| --dir "${assets_dir}" \ | |
| --clobber >/dev/null 2>&1; then | |
| all_assets_ready=true | |
| for asset in "${required_assets[@]}"; do | |
| if [ ! -f "${assets_dir}/${asset}" ]; then | |
| all_assets_ready=false | |
| break | |
| fi | |
| done | |
| if [ "${all_assets_ready}" = true ]; then | |
| break | |
| fi | |
| fi | |
| if [ "${attempt}" -eq 60 ]; then | |
| echo "Timed out waiting for CLI release archives on ${GITHUB_REF_NAME}" >&2 | |
| exit 1 | |
| fi | |
| sleep 10 | |
| done | |
| sha_for() { | |
| sha256sum "${assets_dir}/$1" | awk '{print $1}' | |
| } | |
| darwin_amd64_sha256="$(sha_for "open-browser-use-cli-${version}-darwin-amd64.tar.gz")" | |
| darwin_arm64_sha256="$(sha_for "open-browser-use-cli-${version}-darwin-arm64.tar.gz")" | |
| linux_amd64_sha256="$(sha_for "open-browser-use-cli-${version}-linux-amd64.tar.gz")" | |
| linux_arm64_sha256="$(sha_for "open-browser-use-cli-${version}-linux-arm64.tar.gz")" | |
| tmp_dir="$(mktemp -d)" | |
| trap 'rm -rf "${tmp_dir}" "${assets_dir}"' EXIT | |
| git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/${HOMEBREW_TAP_REPOSITORY}.git" "${tmp_dir}/tap" | |
| mkdir -p "${tmp_dir}/tap/Formula" | |
| ./scripts/render-homebrew-formula.sh \ | |
| "${version}" \ | |
| "${darwin_amd64_sha256}" \ | |
| "${darwin_arm64_sha256}" \ | |
| "${linux_amd64_sha256}" \ | |
| "${linux_arm64_sha256}" \ | |
| > "${tmp_dir}/tap/Formula/open-browser-use.rb" | |
| cd "${tmp_dir}/tap" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add Formula/open-browser-use.rb | |
| if git diff --cached --quiet; then | |
| echo "Homebrew formula already up to date" | |
| exit 0 | |
| fi | |
| git commit -m "Update open-browser-use to ${GITHUB_REF_NAME}" | |
| git push origin HEAD:main |