Skip to content

Commit 97f2f99

Browse files
committed
add homebrew support
1 parent 75e1615 commit 97f2f99

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

brew/template.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Codefresh < Formula
2+
desc "Codefresh CLI provides a full and flexible interface to interact with Codefresh."
3+
homepage "http://cli.codefresh.io"
4+
url "https://github.com/codefresh-io/cli/releases/download/{{ VERSION }}/codefresh-{{ VERSION }}-macos-x64.tar.gz"
5+
version "{{ VERSION }}"
6+
sha256 "{{ SHA256 }}"
7+
8+
def install
9+
bin.install "codefresh"
10+
end
11+
12+
test do
13+
system "#{bin}/codefresh version"
14+
end
15+
end

codefresh-brew.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '1.0'
2+
3+
steps:
4+
5+
# fail_if_not_master:
6+
# title: "Validate running on master branch"
7+
# image: codefresh/cli-build
8+
# commands:
9+
# - 'echo This pipeline should be run only on master'
10+
# - 'exit 1'
11+
# when:
12+
# branch:
13+
# ignore: [ master ]
14+
15+
extract_version:
16+
title: "Exporting package.json version"
17+
image: codefresh/cli-build
18+
commands:
19+
- 'export VERSION=v$(jq -r ".version" package.json)'
20+
- "echo Codefresh CLI version: $VERSION"
21+
- "cf_export VERSION"
22+
23+
update_brew_formula:
24+
title: "Updating homebrew formula"
25+
image: codefresh/cli-build
26+
commands:
27+
- curl -L https://github.com/codefresh-io/cli/releases/download/${{VERSION}}/codefresh-${{VERSION}}-macos-x64.tar.gz > ${{VERSION}}.tar.gz
28+
- echo "compute SHA256 ..."
29+
- SHA256="$(shasum -a 256 ./${{VERSION}}.tar.gz | awk '{print $1}')"
30+
- echo "generate file from template ..."
31+
- sed -e "s/{{ VERSION }}/${{VERSION}}/g" -e "s/{{ SHA256 }}/$SHA256/g" ./brew/template.rb > codefresh.rb
32+
- echo "Updating file in GitHub"
33+
- |
34+
curl -v -i -X PUT -H 'Authorization: token '${{GITHUB_TOKEN}}'' -d "{ \
35+
\"message\": \"update formula version ${{VERSION}}\", \
36+
\"content\": \"$(openssl base64 -A -in codefresh.rb)\", \
37+
\"sha\": $(curl -X GET https://api.github.com/repos/codefresh-io/homebrew-cli/contents/Formula/codefresh.rb | jq .sha) \
38+
}" https://api.github.com/repos/codefresh-io/homebrew-cli/contents/Formula/codefresh.rb

0 commit comments

Comments
 (0)