-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.58 KB
/
formula-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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