Skip to content

Commit 579dbd1

Browse files
committed
chore(ci): create a action to auto create pr to h3n4l/homebrew-chatsh if any release publish
1 parent a3fda50 commit 579dbd1

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Create a Pull Request to h3n4l/homebrew-chatsh
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
create-pr-to-h3n4l-homebrew-chatsh:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
repository: h3n4l/homebrew-chatsh
14+
ref: main
15+
- name: Make change to formula
16+
run: |
17+
echo "The current release is ${GITHUB_REF_NAME}"
18+
darwin_x86_64_sha256=$(curl -sL https://github.com/h3n4l/chatsh/releases/download/${GITHUB_REF_NAME}/chatsh-darwin_x86_64.tar.gz.sha256 | sed 's/ chatsh-darwin_x86_64.tar.gz//')
19+
echo "darwin_x86_64_sha256: $darwin_x86_64_sha256"
20+
linux_x86_64_sha256=$(curl -sL https://github.com/h3n4l/chatsh/releases/download/${GITHUB_REF_NAME}/chatsh-linux_x86_64.tar.gz.sha256 | sed 's/ chatsh-linux_x86_64.tar.gz//')
21+
echo "linux_x86_64_sha256: $linux_x86_64_sha256"
22+
23+
cat << EOF > chatsh.rb
24+
# typed: false
25+
# frozen_string_literal: true
26+
27+
class Chatsh < Formula
28+
desc "Translate text to commands in terminal."
29+
homepage "https://github.com/h3n4l/chatsh"
30+
version "${GITHUB_REF_NAME}"
31+
license "MIT"
32+
33+
on_macos do
34+
url "https://github.com/h3n4l/chatsh/releases/download/${GITHUB_REF_NAME}/chatsh-darwin_x86_64.tar.gz"
35+
sha256 "${darwin_x86_64_sha256}"
36+
37+
def install
38+
bin.install "chatsh"
39+
end
40+
end
41+
42+
on_linux do
43+
url "https://github.com/h3n4l/chatsh/releases/download/${GITHUB_REF_NAME}/chatsh-linux_x86_64.tar.gz"
44+
sha256 "${linux_x86_64_sha256}"
45+
46+
def install
47+
bin.install "chatsh"
48+
end
49+
end
50+
end
51+
EOF
52+
53+
- uses: peter-evans/create-pull-request@v3
54+
with:
55+
token: ${{ secrets.PAT_CREATE_PR }}
56+
commit-message: "feat update homebrew-h3n4l to release ${GITHUB_REF_NAME}"
57+
title: "feat: update homebrew-h3n4l to ${GITHUB_REF_NAME}"
58+
committer: h3n4l <[email protected]>
59+
author: h3n4l <[email protected]>
60+
branch: feat/release-${GITHUB_REF_NAME}
61+
delete-branch: true
62+
draft: false
63+
body: |
64+
Update homebrew-h3n4l to release ${GITHUB_REF_NAME}
65+
- Auto-generated by [create-pull-request][1]
66+
67+
[1]: https://github.com/peter-evans/create-pull-request

0 commit comments

Comments
 (0)