diff --git a/.github/workflows/publish-homebrew.yml b/.github/workflows/publish-homebrew.yml new file mode 100644 index 000000000..8e1a791f4 --- /dev/null +++ b/.github/workflows/publish-homebrew.yml @@ -0,0 +1,24 @@ +name: Publish to Homebrew + +on: + workflow_dispatch: + workflow_run: # Only trigger, when the npm-publish workflow succeeded + workflows: ["Node.js Package"] + types: + - completed + +jobs: + homebrew: + name: Bump Homebrew formula + runs-on: ubuntu-latest + steps: + - name: Get Package Version + id: package-version + uses: martinbeentjes/npm-get-version-action@master + + - uses: mislav/bump-homebrew-formula-action@v2 + with: + formula-name: monika + download-url: https://registry.npmjs.org/@hyperjumptech/monika/-/monika-${{ steps.package-version.outputs.current-version }}.tgz + env: + COMMITTER_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/upload-binary.yml b/.github/workflows/upload-binary.yml index d4ef36cdb..d728632ad 100644 --- a/.github/workflows/upload-binary.yml +++ b/.github/workflows/upload-binary.yml @@ -133,14 +133,14 @@ jobs: run: cat ./chocolatey/tools/chocolateyinstall.ps1 - run: echo ${{ steps.get_version.outputs.VERSION }} | sed 's/^.//' > version_number.txt - name: Write version number without preftix + name: Write version number without prefix if: runner.os == 'Windows' - name: See version_number.txt content if: runner.os == 'Windows' run: cat version_number.txt - - name: Read version number without preftix + - name: Read version number without prefix if: runner.os == 'Windows' id: read_version uses: juliangruber/read-file-action@v1 diff --git a/homebrew/monika.example.rb b/homebrew/monika.example.rb new file mode 100644 index 000000000..a105703b2 --- /dev/null +++ b/homebrew/monika.example.rb @@ -0,0 +1,44 @@ +# This file is an example file and generated using https://github.com/zmwangx/homebrew-npm-noob +require "language/node" + +class Monika < Formula + desc "Synthetic monitoring made easy" + homepage "https://monika.hyperjump.tech" + url "https://registry.npmjs.org/@hyperjumptech/monika/-/monika-1.7.2.tgz" + sha256 "ec1e6a934ab1343c3dc5e576dcb73a78cdd6852f8353891889fec0ad4db18bf5" + license "MIT" + + depends_on "node" + + def install + system "npm", "install", *Language::Node.std_npm_install_args(libexec) + bin.install_symlink Dir["#{libexec}/bin/*"] + + # Remove unexpected universal binaries + deuniversalize_machos + end + + test do + (testpath/"config.yml").write <<~EOS + notifications: + - id: 5b3052ed-4d92-4f5d-a949-072b3ebb2497 + type: desktop + probes: + - id: 696a3f57-a674-44b5-8125-a62bd2709ac5 + name: 'test brew.sh' + requests: + - url: https://brew.sh + body: {} + timeout: 10000 + EOS + + monika_stdout = (testpath/"monika.log") + fork do + $stdout.reopen(monika_stdout) + exec bin/"monika", "-r", "1", "-c", testpath/"config.yml" + end + sleep 5 + + assert_match "Starting Monika. Probes: 1. Notifications: 1", monika_stdout.read + end +end \ No newline at end of file