From 0ebb0fc284af3cf564f4feb6cd55d30b0029a410 Mon Sep 17 00:00:00 2001 From: Nanda H Krishna Date: Thu, 13 Feb 2025 11:41:55 -0500 Subject: [PATCH] Remove Homebrew PR workflows Closes https://github.com/getgauge/gauge/issues/2701. Signed-off-by: Nanda H Krishna --- .github/workflows/release.yml | 30 ----------------- build/brew/brew_update.rb | 61 ----------------------------------- build/brew/create_brew_pr.sh | 39 ---------------------- 3 files changed, 130 deletions(-) delete mode 100644 build/brew/brew_update.rb delete mode 100755 build/brew/create_brew_pr.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3d6507d29..2c2cfa226e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -241,33 +241,3 @@ jobs: cd gauge ./package.ps1 choco push "gauge.$Env:GAUGE_VERSION.nupkg" --apikey=$Env:API_KEY --source=https://push.chocolatey.org/ - - brew-release: - runs-on: ubuntu-latest - needs: [gauge-version] - steps: - - uses: actions/checkout@v4 - - run: git fetch --prune --unshallow - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3 - - - name: Fetch gauge version - uses: actions/download-artifact@v4 - with: - name: gauge-version - path: . - - - name: Set gauge version - run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV - - - name: Update brew formula - env: - HOMEBREW_GITHUB_USER_NAME: ${{ secrets.HOMEBREW_GITHUB_USER_NAME }} - HOMEBREW_GITHUB_USER_EMAIL: ${{ secrets.HOMEBREW_GITHUB_USER_EMAIL }} - GITHUB_TOKEN: ${{ secrets.GAUGEBOT_GITHUB_TOKEN }} - run: | - cd build/brew - bash create_brew_pr.sh diff --git a/build/brew/brew_update.rb b/build/brew/brew_update.rb deleted file mode 100644 index 487b52abc7..0000000000 --- a/build/brew/brew_update.rb +++ /dev/null @@ -1,61 +0,0 @@ -# ---------------------------------------------------------------- -# Copyright (c) ThoughtWorks, Inc. -# Licensed under the Apache License, Version 2.0 -# See LICENSE.txt in the project root for license information. -# ---------------------------------------------------------------- - -require 'parser/current' -require 'net/http' -require 'uri' -require 'json' - - -if ARGV.length < 2 - puts 'Minimum two arguments required. -Usage: ruby brew_update.rb . -Example: ruby brew_update.rb 0.3.2 Library/Formula/gauge.rb. -' - exit 1 -end - -Parser::Builders::Default.emit_lambda = true # opt-in to most recent AST format -code = File.read(ARGV[1]) - -class Processor < AST::Processor - attr_accessor :old_sha256 - - def initialize() - @last_value = '' - end - - def on_begin(node) - node.children.each { |c| process(c) } - end - - def on_class(node) - node.children.each { |c| process(c) } - end - - def on_block(node) - node.children.each { |c| process(c) } - end - - def on_send(node) - if node.children[1].to_s == 'sha256' and node.children[2].children[0].instance_of? String - @old_sha256 = node.children[2].children[0] - end - end -end - -ast = Processor.new -ast.process(Parser::CurrentRuby.parse(code)) - -`curl -O -L https://github.com/getgauge/gauge/archive/refs/tags/v#{ARGV[0]}.tar.gz` -sha256 = `shasum -a 256 v#{ARGV[0]}.tar.gz`.split[0] - -code = code.sub! ast.old_sha256, sha256 -code = code.gsub(%r{(https://github.com/getgauge/gauge/archive/refs/tags/)v\d?.\d?.\d?.tar.gz}, "https://github.com/getgauge/gauge/archive/refs/tags/v#{ARGV[0]}.tar.gz") - -File.write(ARGV[1], code) - -puts 'Update done.' diff --git a/build/brew/create_brew_pr.sh b/build/brew/create_brew_pr.sh deleted file mode 100755 index f91fbb2fe2..0000000000 --- a/build/brew/create_brew_pr.sh +++ /dev/null @@ -1,39 +0,0 @@ -# ---------------------------------------------------------------- -# Copyright (c) ThoughtWorks, Inc. -# Licensed under the Apache License, Version 2.0 -# See LICENSE.txt in the project root for license information. -# ----------------------------------------------------------------*/ - -#!/bin/bash - -set -e - -export BRANCH="gauge-$GAUGE_VERSION" - -git config --global user.name "$HOMEBREW_GITHUB_USER_NAME" -git config --global user.email "$HOMEBREW_GITHUB_USER_EMAIL" - -gh repo sync $HOMEBREW_GITHUB_USER_NAME/homebrew-core \ - --source Homebrew/homebrew-core \ - --branch master - -(gh repo clone $HOMEBREW_GITHUB_USER_NAME/homebrew-core) || (gh repo clone Homebrew/homebrew-core && cd homebrew-core && gh repo fork Homebrew/homebrew-core) - -cd homebrew-core -git checkout master - -git branch -D $BRANCH || true -git checkout -b $BRANCH - -gem install parser -ruby ../brew_update.rb $GAUGE_VERSION ./Formula/g/gauge.rb - -git add ./Formula/g/gauge.rb -git commit -m "gauge $GAUGE_VERSION" -git push -f "https://$HOMEBREW_GITHUB_USER_NAME:$GITHUB_TOKEN@github.com/$HOMEBREW_GITHUB_USER_NAME/homebrew-core.git" "gauge-$GAUGE_VERSION" - -echo -e "gauge $GAUGE_VERSION \n\n Please cc getgauge/core for any issue." > desc.txt -gh pr create --repo Homebrew/homebrew-core \ - --title "gauge $GAUGE_VERSION" \ - --body-file ./desc.txt \ - --head $HOMEBREW_GITHUB_USER_NAME:$BRANCH