release-with-homebrew #25
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-with-homebrew | |
on: workflow_dispatch | |
jobs: | |
release-job: | |
name: 'Release and update Homebrew' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- uses: touchlab/read-property@0.1 | |
id: version-name | |
with: | |
file: ./gradle.properties | |
property: VERSION_NAME | |
- name: Echo Version | |
run: echo "${{ steps.version-name.outputs.propVal }}" | |
- name: 'Create Release' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{ steps.version-name.outputs.propVal }} | |
release_name: 'Release ${{ steps.version-name.outputs.propVal }}' | |
body: | | |
Initial release | |
draft: false | |
prerelease: false | |
- name: 'Find release commit sha' | |
run: | | |
git fetch --tags | |
git rev-parse ${{ steps.version-name.outputs.propVal }} > releasesha | |
- name: Read git commit sha into variable | |
id: releasesha | |
run: echo "::set-output name=releasesha::$(cat releasesha)" | |
- name: Apply SSH Key | |
uses: webfactory/ssh-agent@v0.5.4 | |
with: | |
ssh-private-key: ${{ secrets.GITPORTAL_SSH_KEY }} | |
- name: 'Checkout homebrew tap' | |
uses: actions/checkout@v4 | |
with: | |
repository: 'touchlab/homebrew-gitportal' | |
ref: 'main' | |
path: 'homebrew' | |
- name: 'Update homebrew tap info' | |
run: | | |
cd homebrew | |
sed -i'' -e 's/tag:.*$/tag: "${{ steps.version-name.outputs.propVal }}",/g' Formula/gitportal.rb | |
sed -i'' -e 's/revision:.*$/revision: "${{ steps.releasesha.outputs.releasesha }}"/g' Formula/gitportal.rb | |
sed -i'' -e 's/tag:.*$/tag: "${{ steps.version-name.outputs.propVal }}",/g' Formula/gitportal-rc.rb | |
sed -i'' -e 's/revision:.*$/revision: "${{ steps.releasesha.outputs.releasesha }}"/g' Formula/gitportal-rc.rb | |
git config --global user.email "kgalligan@gmail.com" | |
git config --global user.name "Kevin Galligan" | |
git add . | |
git commit -m "Add version ${{ steps.version-name.outputs.propVal }}" | |
git push |