homebrew-update #13
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: homebrew-update | |
on: | |
workflow_dispatch: | |
branches: [ main ] | |
workflow_run: | |
workflows: ["release"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout OneDrive Uploader | |
uses: actions/checkout@v4 | |
with: | |
path: ./onedrive-uploader | |
- name: Set version env | |
run: echo "CI_VERSION=$(cat ./onedrive-uploader/VERSION | awk NF)" >> $GITHUB_ENV | |
- name: Checkout Homebrew Taps | |
uses: actions/checkout@v4 | |
with: | |
repository: virtualzone/homebrew-tap | |
token: ${{ secrets.PAT }} | |
path: ./taps | |
- name: Update Formula | |
run: | | |
URL="https://github.com/virtualzone/onedrive-uploader/archive/refs/tags/${{ env.CI_VERSION }}.tar.gz" | |
CHECKSUM=`curl -sL "${URL}" | sha256sum | awk '{ print $1 }'` | |
cat ./onedrive-uploader/homebrew/onedrive-uploader.rb | sed -e "s/{{version}}/${{ env.CI_VERSION }}/" -e "s/{{sha256sum}}/${CHECKSUM}/" > ./taps/onedrive-uploader.rb | |
- name: Push Homebrew Taps | |
run: | | |
cd ./taps | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -am "Update to ${{ env.CI_VERSION }}" | |
git push | |
fi |