I have several bash scripts in my project that require Bash 4, GNU sed and thelike. Setting that up on local machines is quite straightforward (updating .bashrc, chsh and thelike) but I can't seem to get MacOS based Github Actions to do the same thing.
The following Github Action YAML snipped will install brew, a newer bash version, GNU sed and put them all in the path so that the following scripts will correctly pick them up:
- name: Install Bash 4 and GNU sed on Mac
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install bash
brew install gnu-sed
echo "/usr/local/bin" >> $GITHUB_PATH
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
Make sure that all scripts have #!/usr/bin/env bash as their shebang as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With