Last active
August 4, 2020 11:10
-
-
Save weibeld/712de43d2c0ed718cb74754c0c68a6eb to your computer and use it in GitHub Desktop.
GitHub Actions example workflow — Use Case 2
This file contains hidden or 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: upgrade | |
on: | |
repository_dispatch: | |
types: [upgrade-formula] | |
jobs: | |
main: | |
env: | |
FORMULA: ${{ github.event.client_payload.formula }} | |
URL: ${{ github.event.client_payload.url }} | |
SHA256: ${{ github.event.client_payload.sha256 }} | |
TAP_DIR: /usr/local/Homebrew/Library/Taps/weibeld/homebrew-core | |
runs-on: macos-latest | |
steps: | |
- name: check-input | |
run: '[[ -n "$FORMULA" && -n "$URL" && -n "$SHA256" ]]' | |
- uses: actions/checkout@v2 | |
- name: install-tap | |
run: mkdir -p "${TAP_DIR%/*}" && ln -s "$PWD" "$TAP_DIR" | |
- name: determine-old-version | |
run: echo "::set-env name=VERSION_OLD::$(brew info --json k1s | jq -r first.versions.stable)" | |
- name: upgrade-formula | |
run: brew bump-formula-pr --dry-run --write --url "$URL" --sha256 "$SHA256" "$FORMULA" | |
- name: determine-new-version | |
run: echo "::set-env name=VERSION_NEW::$(brew info --json k1s | jq -r first.versions.stable)" | |
- name: commit-and-push | |
run: | | |
git add "Formula/$FORMULA.rb" | |
git config user.name "GitHub Actions" | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git commit -m "Upgrade $FORMULA from $VERSION_OLD to $VERSION_NEW" | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment