Skip to content

Release homebrew pact from ec6ad944db3c092fe35f7f4507cf051b9bbd1ef8 #6

Release homebrew pact from ec6ad944db3c092fe35f7f4507cf051b9bbd1ef8

Release homebrew pact from ec6ad944db3c092fe35f7f4507cf051b9bbd1ef8 #6

Workflow file for this run

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 '' -E "s/($HEAD_SEARCH)($ON_TARGET do[[:space:]]*url \"[a-z0-9:\/\.\-]+\"[[:space:]]*sha256 \")[0-9a-f]+\"/\1\2$RELEASE_SHA\"/" pact.rb
sed -i '' -E "s/($HEAD_SEARCH)($ON_TARGET do[[:space:]]*url \")[a-z0-9:\/\.\-]+\"/\1\2$RELEASE_URL\"/" 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 "[email protected]"
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