Skip to content

release-tagged

release-tagged #44

name: Update Homebrew Formulas
on:
repository_dispatch:
types: [release-tagged]
workflow_dispatch:
inputs:
tag:
description: "Version to build"
required: true
default: "v1.0.3"
project:
description: "Project to build"
required: true
default: "renterd"
permissions:
contents: write
pull-requests: write
jobs:
update-formula:
runs-on: ubuntu-latest
steps:
- name: Store input in env
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "RELEASE_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
echo "PROJECT=${{ github.event.inputs.project }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "RELEASE_TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
echo "PROJECT=${{ github.event.client_payload.project }}" >> $GITHUB_ENV
fi
- name: Checkout repository
uses: actions/checkout@v3
- name: Update Homebrew Formula for ${{ env.PROJECT }}
run: |
sed -i 's/tag: "[^"]*"/tag: "${{ env.RELEASE_TAG }}"/' ./Formula/${{ env.PROJECT }}.rb
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
delete-branch: true
commit-message: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
title: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
body: "This is an automated PR to update the ${{ env.PROJECT }} formula"
branch: ${{ env.PROJECT }}/update
base: master