-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Maintainer: Lefthook <[email protected]> | ||
|
||
pkgname=lefthook | ||
pkgdesc="Git hooks manager" | ||
pkgver=1.9.3 | ||
pkgrel=1 | ||
arch=('x86_64' 'aarch64') | ||
url="https://github.com/evilmartians/lefthook" | ||
license=('MIT') | ||
makedepends=('go>=1.21' 'rsync') | ||
source=("https://github.com/evilmartians/lefthook/archive/v${pkgver}.tar.gz") | ||
sha256sums=('{{ sha256sum }}') | ||
|
||
build() { | ||
cd "$pkgname-$pkgver" | ||
go build \ | ||
-trimpath \ | ||
-buildmode=pie \ | ||
-mod=readonly \ | ||
-modcacherw \ | ||
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ | ||
. | ||
} | ||
|
||
package() { | ||
cd "$pkgname-$pkgver" | ||
install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "fileutils" | ||
require "digest" | ||
|
||
VERSION = "1.9.3" | ||
|
||
|
@@ -38,6 +39,7 @@ def set_version | |
replace_in_file("npm/lefthook/package.json", /"(lefthook-.+)": "[\d.]+"/, %{"\\1": "#{VERSION}"}) | ||
replace_in_file("rubygems/lefthook.gemspec", /(spec\.version\s+= ).*/, %{\\1"#{VERSION}"}) | ||
replace_in_file("pypi/setup.py", /(version+=).*/, %{\\1'#{VERSION}',}) | ||
replace_in_file("aur/PKGBUILD", /(pkgver+=).*/, %{\\1#{VERSION}}) | ||
end | ||
|
||
def put_readme | ||
|
@@ -160,6 +162,35 @@ def publish_pypi | |
system("python -m twine upload --verbose --repository lefthook dist/*", exception: true) | ||
end | ||
|
||
def publish_aur | ||
aur_repo = File.join(__dir__, "lefthook-aur") | ||
system("git clone ssh://[email protected]/lefthook.git #{aur_repo}") | ||
pkgbuild_source = File.join(__dir__, "aur", "PKGBUILD") | ||
pkgbuild_dest = File.join(aur_repo, "PKGBUILD") | ||
cp(pkgbuild_source, pkgbuild_dest, verbose: true) | ||
|
||
cd(aur_repo) | ||
|
||
sha256 = Digest::SHA256.new | ||
File.open(File.join(DIST, 'lefthook_source.tar.gz'), 'rb') do |file| | ||
while chunk = file.read(1024) # Read the file in chunks | ||
sha256.update(chunk) | ||
end | ||
end | ||
sha256sum = sha256.hexdigest | ||
replace_in_file(pkgbuild_dest, /{{ sha256sum }}/, sha256sum) | ||
|
||
system("makepkg --printsrcinfo > .SRCINFO") | ||
system("makepkg") | ||
system("makepkg --install") | ||
|
||
system("git config user.name 'github-actions[bot]'") | ||
system("git config user.email 'github-actions[bot]@users.noreply.github.com'") | ||
system("git add PKGBUILD .SRCINFO") | ||
system("git commit -m 'release v#{VERSION}'") | ||
system("git push origin master") | ||
end | ||
|
||
def replace_in_file(filepath, regexp, value) | ||
text = File.open(filepath, "r") do |f| | ||
f.read | ||
|