Search code examples
macosgithubgithub-actions

How to run bash script on MacOS GitHub's workflow?


During CMake step I configure path.sh file with the following content:

echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_OPENSSL@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_FREETYPE@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_LIBJPEG@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_LIBPNG@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_BZIP2@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_BROTLI@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile
echo "export DYLD_LIBRARY_PATH=@CONAN_LIB_DIRS_ZLIB@:$DYLD_LIBRARY_PATH" >> /Users/runner/.bash_profile

I just want to set up DYLD_LIBRARY_PATH with Conan's libraries.

In GitHub workflow file I have:

- name: Append DYLD_LIBRARY_PATH with packages' lib directories
  run: ${{ github.workspace }}/path.sh

But it fails with:

/Users/runner/work/_temp/....sh: line 1: /Users/runner/work/.../path.sh: Permission denied

How can I run bash script on MacOS GitHub's workflow?

I solved the problem with another approach, but the subject... Is it possible?


Solution

  • add chmod +x to your run:

    env:
      DYLD_PATH: ${{ github.workspace }}/path.sh
    jobs:.....
        - name: Append DYLD_LIBRARY_PATH with packages' lib directories
          run: |
            chmod +x ${{ DYLD_PATH }}
            ${{ DYLD_PATH }}