Skip to content

Commit

Permalink
Simplify GitHub workflow for Homebrew
Browse files Browse the repository at this point in the history
This change simplifies and modifies the GitHub workflow set up for Homebrew. The matrix strategy that was previously implemented has been removed. It adjusted the download links for the release tarball and updated the Ruby file accordingly. Search for a specific file ('asd.rb') was also added whilst commit and push mechanism was simplified.
  • Loading branch information
koriym committed Jun 13, 2024
1 parent 7644bec commit d5a4ae0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
jobs:
update:
runs-on: ubuntu-latest
strategy:
matrix:
command: ['asd']

steps:
- name: Checkout code
Expand Down Expand Up @@ -49,29 +46,27 @@ jobs:

- name: Download release tarball
run: |
wget https://github.com/alps-asd/app-state-diagram/releases/download/${{ steps.latest_release.outputs.tag }}/${{ matrix.command }}
wget https://github.com/alps-asd/app-state-diagram/releases/download/${{ steps.latest_release.outputs.tag }}/${{ matrix.command }}
wget https://github.com/alps-asd/app-state-diagram/archive/refs/tags/${{ steps.latest_release.outputs.tag }}.tar.gz
- name: Calculate SHA256
id: sha
run: |
echo "::set-output name=sha::$(sha256sum ./${{ matrix.command }} | awk '{ print $1 }')"
echo "::set-output name=sha::$(sha256sum ./${{ steps.latest_release.outputs.tag }}.tar.gz | awk '{ print $1 }')"
- name: Update Ruby file
run: |
pwd
ls
if [ -f "./${{ matrix.command }}.rb" ]; then
ruby -pi -e "gsub(/url \".*\"/, \"url \\\"https://github.com/alps-asd/app-state-diagram/releases/download/${{ steps.latest_release.outputs.tag }}/${{ matrix.command }}\\\"\")" ./${{ matrix.command }}.rb
ruby -pi -e "gsub(/sha256 \".*\"/, \"sha256 \\\"${{ steps.sha.outputs.sha }}\\\"\")" ./${{ matrix.command }}.rb
if [ -f "./asd.rb" ]; then
ruby -pi -e "gsub(/url \".*\"/, \"url \\\"https://github.com/alps-asd/app-state-diagram/archive/refs/tags/${{ steps.latest_release.outputs.tag }}.tar.gz\\\"\")" ./asd.rb
ruby -pi -e "gsub(/sha256 \".*\"/, \"sha256 \\\"${{ steps.sha.outputs.sha }}\\\"\")" ./asd.rb
else
echo "${{ matrix.command }}.rb not found"
echo "asd.rb not found"
fi
- name: Commit and push if it changed
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git pull origin 1.x
git commit -am "Update to ${{ steps.latest_release.outputs.tag }}" --allow-empty
git push

0 comments on commit d5a4ae0

Please sign in to comment.