feat: migrate gitea to homebrew-core (#178)

Same to tea, we have incorporated gitea into homebrew-core as well. (PR, https://github.com/Homebrew/homebrew-core/pull/141302). I think we can just transition to core. Thanks!

This is the formula page, https://formulae.brew.sh/formula/gitea

Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/178
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-committed-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2023-09-14 05:37:30 +00:00 committed by techknowlogick
parent 3e980e7c7f
commit 6eaa69b988
5 changed files with 2 additions and 115 deletions

View File

@ -24,10 +24,6 @@ jobs:
- name: test install
run: |
brew tap gitea/gitea "${PWD}"
brew install gitea/gitea/tea
tea --version
brew install gitea/gitea/gitea
gitea --version
brew install gitea/gitea/act_runner
act_runner --version
# TODO: test for arm

View File

@ -1,18 +1,12 @@
#!/bin/sh
binaries="tea act_runner gitea"
binaries="act_runner"
for bin in ${binaries};do
file="${bin}.rb"
case "$bin" in
tea)
git_url="https://gitea.com/gitea/tea"
supported_os="linux-386 linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";;
act_runner)
git_url="https://gitea.com/gitea/act_runner"
supported_os="linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";;
gitea)
git_url="https://github.com/go-gitea/gitea"
supported_os="linux-386 linux-amd64 linux-arm64 darwin-10.12-amd64 darwin-10.12-arm64";;
*)
>&2 echo "Error: unrecognized binary ($bin)"
exit 1;;

View File

@ -1,48 +0,0 @@
require_relative './utils/macos_codesign.rb'
class GiteaHead < Formula
desc "Git with a cup of tea, painless self-hosted git service"
homepage "https://gitea.io"
version "main"
license "MIT"
os = OS.mac? ? "darwin-10.12" : "linux"
arch = case Hardware::CPU.arch
when :i386 then "386"
when :x86_64 then "amd64"
when :arm64 then "arm64"
else
raise "gitea: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "gitea-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}"
@@using = :nounzip
if os == "darwin-10.12" || arch == "amd64"
@@url += ".xz"
@@using = nil
depends_on "xz"
end
@@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first
sha256 @@sha256
url @@url,
using: @@using
conflicts_with "gitea", because: "both install gitea binaries"
def install
if stable.using.blank?
filename = GiteaHead.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
apply_ad_hoc_signature(filename)
bin.install filename => "gitea"
end
test do
system "#{bin}/gitea", "--version"
end
end

View File

@ -1,56 +0,0 @@
require_relative './utils/macos_codesign.rb'
class Gitea < Formula
desc "Git with a cup of tea, painless self-hosted git service"
homepage "https://gitea.io"
version "1.20.4"
license "MIT"
os = OS.mac? ? "darwin-10.12" : "linux"
arch = case Hardware::CPU.arch
when :i386 then "386"
when :x86_64 then "amd64"
when :arm64 then "arm64"
else
raise "gitea: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "gitea-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}"
@@using = :nounzip
if os == "darwin-10.12" || arch == "amd64"
@@url += ".xz"
@@using = nil
depends_on "xz"
end
@@sha256 = case "#{os}-#{arch}"
when "linux-386" then "ad38dba630a3598488ad46d74283f826b68905168f1830b2142c398074ed79d0" # binary
when "linux-amd64" then "66e64dfe991fb02c1a6f141eb4245be5de3d790e85df03d3659935dfdb070e39"
when "linux-arm64" then "95f8e1b29f1402b4af5e12ed6d2da6fad35ae8c99f413e7afbf265aeb85eb6d7" # binary
when "darwin-10.12-amd64" then "b814918cfb7efe5c41a03712d047ef7fdd2113fdd4cce3b1a0c46994923bf84a"
when "darwin-10.12-arm64" then "941991b7edad8dd5026e843f611000d5a3032c0024272896c0bd6b13507b6fee"
else
raise "gitea: Unsupported system #{os}-#{arch}"
end
sha256 @@sha256
url @@url,
using: @@using
conflicts_with "gitea-head", because: "both install gitea binaries"
def install
if stable.using.blank?
filename = Gitea.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
apply_ad_hoc_signature(filename)
bin.install filename => "gitea"
end
test do
system "#{bin}/gitea", "--version"
end
end

View File

@ -1,3 +1,4 @@
{
"gitea": "homebrew/core",
"tea": "homebrew/core"
}