Skip to content

Extract character from matrix variable #26350

Answered by shivammathur
reikdas asked this question in Actions
Discussion options

You must be logged in to vote

Store the compiler value from matrix as an env variable and use that.

- name: Set compiler    
  run: |
    if [[ "$compiler" =~ ^gcc* ]]; then
      echo "CC=gcc-${compiler:4}" >> $GITHUB_ENV
      echo "CXX=g++-${compiler:4}" >> $GITHUB_ENV
    else
      echo "CC=clang-${compiler:6}" >> $GITHUB_ENV
      echo "CXX=clang++-${compiler:6}" >> $GITHUB_ENV
    fi
  env:
    compiler: ${{ matrix.compiler }}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants