Manual update Product Formula in Tap #15
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
name: Manual update Product Formula in Tap | |
# In the case of automation failure, this workflow allows a user to manually run a product version update. | |
# Note for casks - the templater automatically adds "hashicorp-" as a prefix, so only use product name. | |
on: | |
workflow_dispatch: | |
inputs: | |
product: | |
description: product name as it appears in binary (ie. "vault", "vault-enterprise", etc.) | |
version: | |
description: semantic version string (ie. "1.12.2") | |
is_cask: | |
type: boolean | |
description: check if updating a cask (rather than a tap formula) | |
default: false | |
jobs: | |
update-formula: | |
name: Update Formula | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 #v5.0.1 | |
with: | |
go-version-file: "util/formula_templater/go.mod" | |
- name: Build formula_templater CLI | |
run: | | |
cd util/formula_templater && go build | |
- name: Generate new formula | |
if: ${{ github.event.inputs.is_cask == 'false' }} | |
run: | | |
./util/formula_templater/formula_templater \ | |
${{github.event.inputs.product}} \ | |
${{github.event.inputs.version}} \ | |
./util/formula_templater/config.hcl > ./Formula/${{github.event.inputs.product}}.rb | |
- name: Generate new cask | |
if: ${{ github.event.inputs.is_cask == 'true' }} | |
run: | | |
./util/formula_templater/formula_templater \ | |
-cask \ | |
${{github.event.inputs.product}} \ | |
${{github.event.inputs.version}} \ | |
./util/formula_templater/config.hcl > ./Casks/hashicorp-${{github.event.inputs.product}}.rb | |
- name: Publish Change | |
run: | | |
git config user.name hc-espd-packager | |
git config user.email team-rel-eng@hashicorp.com | |
git add Formula/*.rb Casks/*.rb | |
git commit -m "Bump ${{ github.event.inputs.product }} to ${{ github.event.inputs.version }}" | |
# Ensure we have any changes that might have been merged before we push. This narrows the window in which a | |
# race from multiple changes happening at once can occur. Conflicts/Races could still occur though unlikley. | |
git pull --rebase | |
git push |