49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: Update Homebrew Tap
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag (e.g. v0.10.0)'
|
|
required: true
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
update-tap:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Update cask
|
|
env:
|
|
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
|
VERSION="${TAG#v}"
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
gh release download "$TAG" \
|
|
--repo "$GITHUB_REPOSITORY" \
|
|
--pattern 'OpenPencil_aarch64.app.tar.gz' \
|
|
--pattern 'OpenPencil_x64.app.tar.gz' \
|
|
--dir "$TMPDIR"
|
|
|
|
SHA_ARM=$(shasum -a 256 "$TMPDIR/OpenPencil_aarch64.app.tar.gz" | cut -d' ' -f1)
|
|
SHA_X64=$(shasum -a 256 "$TMPDIR/OpenPencil_x64.app.tar.gz" | cut -d' ' -f1)
|
|
|
|
git clone "https://x-access-token:${GH_TOKEN}@github.com/open-pencil/homebrew-tap.git" "$TMPDIR/tap"
|
|
cd "$TMPDIR/tap"
|
|
|
|
sed -i '' \
|
|
-e "s/version \".*\"/version \"$VERSION\"/" \
|
|
-e "/on_arm/,/end/{s/sha256 \".*\"/sha256 \"$SHA_ARM\"/;}" \
|
|
-e "/on_intel/,/end/{s/sha256 \".*\"/sha256 \"$SHA_X64\"/;}" \
|
|
Casks/open-pencil.rb
|
|
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add Casks/open-pencil.rb
|
|
git commit -m "Update OpenPencil to $VERSION"
|
|
git push
|