Skip to content

Commit

Permalink
Fix update-homebrew job and bump (#86)
Browse files Browse the repository at this point in the history
Signed-off-by: Taiki Ono <taiki@finatext.com>
  • Loading branch information
taiki45 authored Jun 20, 2024
1 parent 6dfc373 commit d129fc7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
18 changes: 1 addition & 17 deletions .github/scripts/update_formula
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env ruby

require 'octokit'
require 'open-uri'
require 'digest'

Expand All @@ -10,7 +9,6 @@ LOCAL = ENV.fetch('LOCAL', false)

tag = GITHUB_REF.sub('refs/tags/v', '')
formula_path = "HomebrewFormula/#{TARGET}.rb"
repo = "Finatext/#{TARGET}"

content = File.read(formula_path)

Expand All @@ -33,18 +31,4 @@ urls.each do |url|
end
end

if LOCAL
File.write(formula_path, updated_content)
else
client = Octokit::Client.new(access_token: ENV.fetch('GITHUB_TOKEN'))
formula_file = client.contents(repo, path: formula_path, ref: tag)

client.update_contents(repo,
formula_path,
"Update Homebrew formula for #{tag}",
formula_file.sha,
updated_content,
branch: 'main',
file: formula_path
)
end
File.write(formula_path, updated_content)
12 changes: 9 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ jobs:
- build-release
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
shell: bash
run: sudo gem install octokit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Update Homebrew Formula
env:
Expand All @@ -139,3 +136,12 @@ jobs:
shell: bash
run: |
.github/scripts/update_formula
- name: Commit and push changes
run: |
git diff
git add HomebrewFormula/gls.rb
git -c user.email='41898282+github-actions[bot]@users.noreply.github.com' \
-c user.name='github-actions[bot]' \
-m "Update Homebrew formula" \
commit
git push
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "gls"
description = "Support gitleaks config development and extend some gitleaks features."
version = "0.1.12"
version = "0.1.13"
edition = "2021"
rust-version = "1.70.0"
readme = "README.md"
Expand Down

0 comments on commit d129fc7

Please sign in to comment.