2024-05-24 01:42:06 +00:00
|
|
|
---
|
|
|
|
# This action is a candidate to centrally manage in https://github.com/<organization>/.github/
|
|
|
|
# If more Homebrew applications are developed, consider moving this action to the organization's .github repository,
|
2024-07-12 17:53:19 +00:00
|
|
|
# using the `homebrew-pkg` repository label to identify repositories that should trigger this workflow.
|
2024-05-24 01:42:06 +00:00
|
|
|
|
|
|
|
# Update Homebrew on release events.
|
|
|
|
|
|
|
|
name: Update Homebrew release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
2024-10-05 01:47:04 +00:00
|
|
|
types: [released]
|
2024-05-24 01:42:06 +00:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
update-homebrew-release:
|
|
|
|
if: >-
|
2024-10-05 01:47:04 +00:00
|
|
|
github.repository_owner == 'LizardByte'
|
2024-05-24 01:42:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check if Homebrew repo
|
|
|
|
env:
|
|
|
|
TOPIC: homebrew-pkg
|
2024-10-05 01:47:04 +00:00
|
|
|
id: check-label
|
2024-05-24 01:42:06 +00:00
|
|
|
uses: actions/github-script@v7
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const topic = process.env.TOPIC;
|
|
|
|
console.log(`Checking if repo has topic: ${topic}`);
|
|
|
|
|
|
|
|
const repoTopics = await github.rest.repos.getAllTopics({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo
|
|
|
|
});
|
|
|
|
console.log(`Repo topics: ${repoTopics.data.names}`);
|
|
|
|
|
|
|
|
const hasTopic = repoTopics.data.names.includes(topic);
|
|
|
|
console.log(`Has topic: ${hasTopic}`);
|
|
|
|
|
|
|
|
core.setOutput('hasTopic', hasTopic);
|
|
|
|
|
|
|
|
- name: Download release asset
|
|
|
|
id: download
|
|
|
|
if: >-
|
2024-10-05 01:47:04 +00:00
|
|
|
steps.check-label.outputs.hasTopic == 'true'
|
2024-07-01 19:17:48 +00:00
|
|
|
uses: robinraju/release-downloader@v1.11
|
2024-05-24 01:42:06 +00:00
|
|
|
with:
|
|
|
|
repository: "${{ github.repository }}"
|
|
|
|
tag: "${{ github.event.release.tag_name }}"
|
|
|
|
fileName: "*.rb"
|
|
|
|
tarBall: false
|
|
|
|
zipBall: false
|
|
|
|
out-file-path: "release_downloads"
|
|
|
|
extract: false
|
|
|
|
|
|
|
|
- name: Publish Homebrew Formula
|
|
|
|
if: >-
|
2024-10-05 01:47:04 +00:00
|
|
|
steps.check-label.outputs.hasTopic == 'true' &&
|
2024-05-24 01:42:06 +00:00
|
|
|
fromJson(steps.download.outputs.downloaded_files)[0]
|
2024-09-20 14:53:10 +00:00
|
|
|
uses: LizardByte/homebrew-release-action@v2024.919.145818
|
2024-05-24 01:42:06 +00:00
|
|
|
with:
|
|
|
|
formula_file: ${{ fromJson(steps.download.outputs.downloaded_files)[0] }}
|
|
|
|
git_email: ${{ secrets.GH_BOT_EMAIL }}
|
|
|
|
git_username: ${{ secrets.GH_BOT_NAME }}
|
|
|
|
publish: true
|
|
|
|
token: ${{ secrets.GH_BOT_TOKEN }}
|
|
|
|
validate: false
|