feat(misc): add scripts to publish homebrew cask
This commit is contained in:
parent
b5ac6b85c5
commit
50a67baf03
43
scripts/publish_homebrew_version.sh
Executable file
43
scripts/publish_homebrew_version.sh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ -z "$VERSION" ]]; then
|
||||||
|
echo "Missing target VERSION environment variable, please specify it"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Removing the v suffix, if present
|
||||||
|
VERSION=${VERSION#"v"}
|
||||||
|
|
||||||
|
rm -Rf target/homebrew
|
||||||
|
mkdir -p target/homebrew/artifacts
|
||||||
|
|
||||||
|
echo "Targeting version $VERSION"
|
||||||
|
echo "Downloading macOS artifacts"
|
||||||
|
|
||||||
|
gh release download v$VERSION --pattern "Espanso-Mac*" --dir target/homebrew/artifacts
|
||||||
|
|
||||||
|
echo "Reading artifacts hashes"
|
||||||
|
INTEL_SHA=$(cat target/homebrew/artifacts/Espanso-Mac-Intel.zip.sha256.txt | awk -F ' ' '{print $1}')
|
||||||
|
M1_SHA=$(cat target/homebrew/artifacts/Espanso-Mac-M1.zip.sha256.txt | awk -F ' ' '{print $1}')
|
||||||
|
|
||||||
|
echo "Cloning tap repository"
|
||||||
|
|
||||||
|
pushd target/homebrew
|
||||||
|
git clone git@github.com:espanso/homebrew-espanso.git
|
||||||
|
|
||||||
|
pushd homebrew-espanso
|
||||||
|
echo "Rendering formula template"
|
||||||
|
|
||||||
|
cat ../../../scripts/resources/macos/formula_template.rb | sed "s/{{{VERSION}}}/$VERSION/g" | \
|
||||||
|
sed "s/{{{INTEL_SHA}}}/$INTEL_SHA/g" | sed "s/{{{M1_SHA}}}/$M1_SHA/g" > ./Casks/espanso.rb
|
||||||
|
|
||||||
|
echo "Committing version update"
|
||||||
|
git add Casks/espanso.rb
|
||||||
|
git commit -m "Version bump: $VERSION"
|
||||||
|
|
||||||
|
echo "Pushing changes"
|
||||||
|
git push
|
||||||
|
|
||||||
|
echo "Done!"
|
19
scripts/resources/macos/formula_template.rb
Normal file
19
scripts/resources/macos/formula_template.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
cask "espanso" do
|
||||||
|
version "{{{VERSION}}}"
|
||||||
|
|
||||||
|
if Hardware::CPU.intel?
|
||||||
|
url "https://github.com/federico-terzi/espanso/releases/download/v#{version}/Espanso-Mac-Intel.zip"
|
||||||
|
sha256 "{{{INTEL_SHA}}}"
|
||||||
|
else
|
||||||
|
url "https://github.com/federico-terzi/espanso/releases/download/v#{version}/Espanso-Mac-M1.zip"
|
||||||
|
sha256 "{{{M1_SHA}}}"
|
||||||
|
end
|
||||||
|
|
||||||
|
name "Espanso"
|
||||||
|
desc "A Privacy-first, Cross-platform Text Expander"
|
||||||
|
homepage "https://espanso.org/"
|
||||||
|
|
||||||
|
app "Espanso.app"
|
||||||
|
|
||||||
|
zap trash: "~/Library/Caches/espanso"
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user