Skip to content

package_update

package_update #12

name: Package Update
on:
repository_dispatch:
types: [package_update]
jobs:
formula_update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set env
run: |
echo "FORMULA=${{ github.event.client_payload.formula }}" >> $GITHUB_ENV
echo "VERSION=${{ github.event.client_payload.version }}" >> $GITHUB_ENV
echo "ZIP_URL=${{ github.event.client_payload.zip_url }}" >> $GITHUB_ENV
echo "SHA256=${{ github.event.client_payload.sha256 }}" >> $GITHUB_ENV
- name: Update formula file
run: |
FILE="./Formula/${{ env.FORMULA }}.rb"
VERSION=`echo ${{ env.VERSION }} | sed -e 's/[a-z]\{1\}//'`
sed -i ${FILE} \
-e 's/version ".\+"$/version "'${VERSION}'"/' \
-e 's@url ".\+"$@url "'${{ env.ZIP_URL }}'"@' \
-e 's/sha256 ".\+"$/sha256 "'${{ env.SHA256 }}'"/'
cat ${FILE}
- name: Commit
run: |
git config --global user.email [email protected]
git config --global user.name "Ayanel CI"
git add ./Formula
git commit -m "Update ${{ env.FORMULA }}: ${{ env.VERSION }}"
git push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git HEAD:main