.github/workflows/update-formula.yaml #17
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; | |
const url = releaseInfo.html_url; | |
console.log(`Creating a PR for release ${id} by ${creator}. \nDescription: ${desc}`) | |
const outputs = { | |
releaseId: id, | |
releaseCreator: creator, | |
releaseUpstreamBody: desc, | |
releaseName: context.payload.inputs.release_tag.slice(1), | |
releaseUrl: url | |
}; | |
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.releaseUpstreamBody}} | |
--- | |
Link to release: ${{steps.get_release.outputs.releaseUrl}} | |
Release created by: @${{steps.get_release.outputs.releaseCreator}} | |