Publish Homebrew #9
Workflow file for this run
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
name: Publish Homebrew | |
on: | |
release: | |
types: [published] | |
workflow_call: | |
inputs: | |
version: | |
description: Package version | |
required: false | |
type: string | |
dryrun: | |
description: Do not create PR | |
required: true | |
type: boolean | |
secrets: | |
MAA_HOMEBREW_BUMP_PR: | |
description: GitHub PAT for creating PR | |
required: true | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Package version | |
required: false | |
type: string | |
dryrun: | |
description: Do not create PR | |
default: true | |
required: true | |
type: boolean | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.MAA_HOMEBREW_BUMP_PR }} | |
jobs: | |
meta: | |
name: Meta | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
dryrun: ${{ steps.dryrun.outputs.dryrun }} | |
steps: | |
- name: Check if Dryrun | |
id: dryrun | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = "release" ]; then | |
dryrun='false' | |
else | |
dryrun='${{ inputs.dryrun }}' | |
fi | |
echo "Dryrun: $dryrun" | |
echo "dryrun=$dryrun" >> $GITHUB_OUTPUT | |
- name: Get version | |
id : version | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = "release" ]; then | |
tag='${{ github.ref }}' | |
version=${tag#refs/tags/v} | |
else | |
version='${{ inputs.version }}' | |
fi | |
echo "Version: $version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
formula: | |
name: Formula | |
needs: [meta] | |
runs-on: macos-latest | |
steps: | |
- name: Tap MaasistantArknights Tap | |
run: brew tap MaaAssistantArknights/homebrew-tap | |
- name: Bump Formula | |
run: > | |
brew bump-formula-pr maa-cli | |
${{ fromJson(needs.meta.outputs.dryrun) && '--dry-run' || '' }} | |
--no-browse | |
--version='${{ needs.meta.outputs.version }}' | |
--message='Bump `maa-cli` to `${{ needs.meta.outputs.version }}`' | |
cask: | |
name: Cask | |
needs: [meta] | |
runs-on: macos-latest | |
steps: | |
- name: Tap MaasistantArknights Tap | |
run: brew tap MaaAssistantArknights/homebrew-tap | |
- name: Bump Cask | |
run: > | |
brew bump-cask-pr maa-cli-bin | |
${{ fromJson(needs.meta.outputs.dryrun) && '--dry-run' || '' }} | |
--no-browse | |
--version='${{ needs.meta.outputs.version }}' | |
--message='Bump `maa-cli-bin` to `${{ needs.meta.outputs.version }}`' |