.github/workflows/update-formula.yaml #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} | |