Skip to content

release-tagged

release-tagged #40

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'
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/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
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