-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added github actions to release homebrew to github with updated…
… cli version. (#11) * feat: Added github actions to release homebrew to github with updated cli version * Updated script with git conigurations Co-authored-by: lakshmiravali <[email protected]>
- Loading branch information
1 parent
f3afa4a
commit 3064da6
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version_pattern="[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*" | ||
formula=$1 | ||
version=$2 | ||
sha=$3 | ||
if [ "$version" == '' ] || [ "$sha" == '' ]; then | ||
exit | ||
fi | ||
formula_path="Formula/$formula.rb" | ||
sed -i.bak "s/$formula-v$version_pattern/$formula-v$version/g" "$formula_path" | ||
sed -i.bak "s/version .*/version $version/" "$formula_path" | ||
sed -i.bak "s/sha256 .*/sha256 $sha/" "$formula_path" | ||
echo "Git configurations" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "twilio-dx" | ||
branch=$(git branch --show-current) | ||
echo "Current branch: $branch" | ||
git add -A | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "There are changes to commit."; | ||
git commit -m "Release $version" | ||
git push origin "$branch" | ||
else | ||
echo "No changes to commit"; | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Homebrew Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
formula: | ||
description: 'Formula to release Homebrew' | ||
default: twilio | ||
version: | ||
description: 'Release version - Same as CLI version' | ||
required: true | ||
sha: | ||
description: 'SHA of tar file created by oclif' | ||
pre-release: | ||
description: 'If it is a prerelease send true as input' | ||
default: 'false' | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout to homebrew | ||
uses: actions/checkout@v2 | ||
- name: Update Home Brew with latest sha and version | ||
run: | | ||
source .github/scripts/update-formula.sh "${{github.event.inputs.formula}}" "${{github.event.inputs.version}}" "${{github.event.inputs.sha}}" | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [update] | ||
steps: | ||
- name: Checkout to homebrew | ||
uses: actions/checkout@v2 | ||
- run: git pull | ||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{github.event.inputs.version}} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
prerelease: ${{github.event.inputs.pre-release}} |