fix: brew
This commit is contained in:
@@ -1,68 +0,0 @@
|
|||||||
name: Publish Homebrew Tap
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-homebrew:
|
|
||||||
runs-on: local
|
|
||||||
needs: []
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Wait for release asset
|
|
||||||
run: |
|
|
||||||
TAG="${GITHUB_REF#refs/tags/}"
|
|
||||||
VERSION="${TAG#v}"
|
|
||||||
ASSET_URL="https://github.com/n0va-bot/kewt/releases/download/${TAG}/kewt"
|
|
||||||
|
|
||||||
# Wait for the GitHub release asset to be available
|
|
||||||
for i in $(seq 1 12); do
|
|
||||||
if curl -sLf -o /dev/null "$ASSET_URL" 2>/dev/null; then
|
|
||||||
echo "Asset available at $ASSET_URL"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "Waiting for release asset... (attempt $i)"
|
|
||||||
sleep 10
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Render Formula
|
|
||||||
run: |
|
|
||||||
TAG="${GITHUB_REF#refs/tags/}"
|
|
||||||
VERSION="${TAG#v}"
|
|
||||||
ASSET_URL="https://github.com/n0va-bot/kewt/releases/download/${TAG}/kewt"
|
|
||||||
|
|
||||||
curl -sL -o kewt-binary "$ASSET_URL"
|
|
||||||
CHECKSUM=$(sha256sum kewt-binary | awk '{print $1}')
|
|
||||||
rm -f kewt-binary
|
|
||||||
|
|
||||||
mkdir -p brew-work/Formula
|
|
||||||
sed -e "s/VERSION_PLACEHOLDER/${VERSION}/g" \
|
|
||||||
-e "s/SHA256SUM_PLACEHOLDER/${CHECKSUM}/g" \
|
|
||||||
packaging/homebrew/kewt.rb.template > brew-work/Formula/kewt.rb
|
|
||||||
|
|
||||||
echo "Generated Formula:"
|
|
||||||
cat brew-work/Formula/kewt.rb
|
|
||||||
|
|
||||||
- name: Push to GitHub homebrew-tap
|
|
||||||
run: |
|
|
||||||
TAG="${GITHUB_REF#refs/tags/}"
|
|
||||||
cd brew-work
|
|
||||||
|
|
||||||
git init
|
|
||||||
git remote add origin https://x-access-token:${{ secrets.GH_RELEASE_TOKEN }}@github.com/n0va-bot/homebrew-tap.git
|
|
||||||
git fetch origin main || git checkout --orphan main
|
|
||||||
git checkout main 2>/dev/null || git checkout --orphan main
|
|
||||||
|
|
||||||
# Overwrite with the rendered Formula
|
|
||||||
mkdir -p Formula
|
|
||||||
cp Formula/kewt.rb Formula/kewt.rb
|
|
||||||
|
|
||||||
git add Formula/kewt.rb
|
|
||||||
git config user.name "${{ github.actor }}"
|
|
||||||
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
|
||||||
git commit -m "Update kewt to ${TAG}" || echo "No changes to commit"
|
|
||||||
git push origin main
|
|
||||||
@@ -104,3 +104,37 @@ jobs:
|
|||||||
commit_email: ${{ github.actor }}@users.noreply.github.com
|
commit_email: ${{ github.actor }}@users.noreply.github.com
|
||||||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
commit_message: "Update kewt-bin to ${{ github.ref_name }}"
|
commit_message: "Update kewt-bin to ${{ github.ref_name }}"
|
||||||
|
|
||||||
|
publish-homebrew:
|
||||||
|
runs-on: local
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Render Formula and push to GitHub
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
VERSION="${TAG#v}"
|
||||||
|
|
||||||
|
curl -sL -o kewt-binary \
|
||||||
|
"https://git.krzak.org/N0VA/kewt/releases/download/${TAG}/kewt"
|
||||||
|
CHECKSUM=$(sha256sum kewt-binary | awk '{print $1}')
|
||||||
|
rm -f kewt-binary
|
||||||
|
|
||||||
|
mkdir -p brew-work/Formula
|
||||||
|
sed -e "s/VERSION_PLACEHOLDER/${VERSION}/g" \
|
||||||
|
-e "s/SHA256SUM_PLACEHOLDER/${CHECKSUM}/g" \
|
||||||
|
packaging/homebrew/kewt.rb.template > brew-work/Formula/kewt.rb
|
||||||
|
|
||||||
|
cd brew-work
|
||||||
|
git init
|
||||||
|
git remote add origin https://x-access-token:${{ secrets.GH_RELEASE_TOKEN }}@github.com/n0va-bot/homebrew-tap.git
|
||||||
|
git fetch origin main || true
|
||||||
|
git checkout main 2>/dev/null || git checkout --orphan main
|
||||||
|
|
||||||
|
git add Formula/kewt.rb
|
||||||
|
git config user.name "${{ github.actor }}"
|
||||||
|
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||||
|
git commit -m "Update kewt to ${TAG}" || echo "No changes to commit"
|
||||||
|
git push origin main
|
||||||
|
|||||||
Reference in New Issue
Block a user