Release homebrew pact from 3670cd57b87c8a5f6fd53e6a22542306fa0f9d97 #5
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: Release - Bump Version | |
## Release automation for pact's published packages in brew | |
# Designed to run systems in kadena-io/homebrew-pact | |
# There is a | |
run-name: "Release homebrew pact ${{ inputs.release_sha }} from ${{ github.sha}}" | |
on: | |
workflow_dispatch: | |
inputs: | |
pact_intel: | |
description: "url of latest pact release package for intel" | |
type: string | |
required: false | |
pact_arm: | |
description: "url of latest pact release package for arm" | |
type: string | |
required: false | |
pact_head: | |
description: "url of latest pact-5 release package for arm" | |
type: string | |
required: false | |
workflow_call: | |
inputs: | |
pact_intel: | |
description: "url of latest pact release package for intel" | |
type: string | |
required: false | |
pact_arm: | |
description: "url of latest pact release package for arm" | |
type: string | |
required: false | |
pact_head: | |
description: "url of latest pact-5 release package for arm" | |
type: string | |
required: false | |
jobs: | |
Update-References: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: kadena-io/homebrew-pact | |
ssh-key: ${{ secrets.GH_DEPLOYKEY_PACTBREW }} | |
- name: Update GHC version if needed | |
run: | | |
# we fire this function for every possible url so stop if no url was passed to script | |
# get release to calculate sha (and exit if the curl fails) | |
# escape the release URL / characters | |
# replace the release url and sha | |
# blank out variables to prevent conflicts | |
replace_in_rb() { | |
ON_TARGET=$1 | |
RELEASE_URL=$2 | |
HEAD_SEARCH=$3 | |
if [[ -z "$RELEASE_URL" ]]; then | |
echo "$ON_TARGET is blank, not updating url" | |
return 0 | |
else | |
echo "$ON_TARGET will be updated to $RELEASE_URL" | |
fi | |
curl -L "$RELEASE_URL" --output target.tar.gz || exit 1 | |
RELEASE_SHA=`shasum -a 256 target.tar.gz | awk '{ print $1 }'` | |
RELEASE_URL=$(printf '%s\n' "$RELEASE_URL" | sed 's:[\\/&]:\\&:g; $!s/$/\\/') | |
sed -i --regexp-extended -z "s/($HEAD_SEARCH)($ON_TARGET do\n[ ]*)url \"([a-z0-9:\/\.\-]+)\"(\n[ ]*sha256 \")([0-9a-f]+)\"/\1\2url \"$RELEASE_URL\"\4$RELEASE_SHA\"/" pact.rb | |
ON_TARGET="" | |
RELEASE_URL="" | |
HEAD_SEARCH="" | |
} | |
replace_in_rb on_intel "${{ inputs.pact_intel }}" | |
replace_in_rb on_arm "${{ inputs.pact_arm }}" | |
replace_in_rb on_arm "${{ inputs.pact_head }}" '\<head do\>\n[ ]*' | |
- name: Validate pact arm nightly release | |
run: | | |
brew install --build-from-source pact.rb --head | |
pact -v | |
brew uninstall pact | |
- name: Validate pact arm release | |
run: | | |
brew install --build-from-source pact.rb --head | |
pact -v | |
brew uninstall pact | |
- name: Update master branch with new homebrew | |
run: | | |
git config --local user.name "Kadena DevOps" | |
git config --local user.email "devops@kadena.io" | |
git add pact.rb | |
git commit --allow-empty -m "pact package version update" | |
# allow empty in case this is a re-run | |
git status | |
git tag chainweb-${{ inputs.VERSION_NEW }} | |
git push | |
git push --force origin --tags | |