-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (65 loc) · 2.91 KB
/
update-formula.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
on:
workflow_dispatch:
inputs:
release_tag:
description: 'The tag ref for the release in the Flow repo'
required: true
type: string
jobs:
create_release_pr:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Get Release'
id: get_release
uses: actions/github-script@v6
with:
script: |
let {data: releaseInfo} = await github.rest.repos.getReleaseByTag({
owner: "estuary",
repo: "flow",
tag: context.payload.inputs.release_tag,
});
const desc = releaseInfo.body;
const creator = releaseInfo.author.login;
const id = releaseInfo.id;
console.log(`Creating a PR for release ${id} by ${creator}. \nDescription: ${desc}`)
/* let generationResponse = await github.rest.repos.generateReleaseNotes({
owner: "estuary",
repo: "flow",
tag: context.payload.inputs.release_tag,
})
const {data: {name: releaseName, body: releaseBody}} = generationResponse;
console.log(`Generated release notes:\n${releaseName}\n${releaseBody}`)
*/
const outputs = {
releaseId: id,
releaseCreator: creator,
releaseUpstreamBody: desc,
generatedReleaseName: "Placeholder Autogenerated Name", // releaseName,
generatedReleaseBody: "Placeholder Autogenerated Body", // releaseBody,
releaseName: context.payload.inputs.release_tag.slice(1)
};
const parsed_outputs = Object.entries(outputs).map(([k,v])=>core.setOutput(k,v))
- name: 'Update Homebrew Formula'
run: FLOW_RELEASE_NAME=${{steps.get_release.outputs.releaseName}} bash formula_template.sh > Formula/flowctl.rb
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: |
Release `${{steps.get_release.outputs.releaseName}}`
${{steps.get_release.outputs.releaseUpstreamBody}}
${{steps.get_release.outputs.generatedReleaseBody}}
branch: release/${{steps.get_release.outputs.releaseName}}
delete-branch: true
title: 🚀 Release `${{steps.get_release.outputs.releaseName}}`
author: ${{steps.get_release.outputs.releaseCreator}} <${{steps.get_release.outputs.releaseCreator}}@users.noreply.github.com>
body: |
## ${{steps.get_release.outputs.generatedReleaseName}}
${{steps.get_release.outputs.releaseUpstreamBody}}
---
${{steps.get_release.outputs.generatedReleaseBody}}
Release created by: @${{steps.get_release.outputs.releaseCreator}}