yaml expression syntax

The documentation of expressions in yaml is… not leaving me with the feeling that I know what I’m doing.

Here’s what I want:

jobs:
  build-container-stage1:
    runs-on: ubuntu-latest
    env:
      VERSION: ${{ '0.2' }}
      NAME: ${{ 'subsurface/mxe-build-container:$VERSION.stage1' }}

I have tried at least a dozen ways to do this - with join() expressions, with stage.output constructrs… nothing seems to work.

What would be really useful is a complex, well documented YAML file that exercises many of the things that people might want to use…

Thank you for your suggestion.

If you want to use VERSION environment variable in NAME , I would suggest you use ${{env.VERSION}} instead of $VERSION in step.env. Please check my example:

jobs:

  job1:

    runs-on: ubuntu-latest

    env:

      VERSION: ${{ ‘0.2’ }}

    

    steps:

    - uses: actions/checkout@v1

    - run: echo ‘version’  $VERSION  ‘name’ $NAME

       env:

          NAME: subsurface/mxe-build-container:${{env.VERSION}}.stage1

There is a similar issue for how to use env context:https://github.community/t5/GitHub-Actions/How-to-use-env-context/td-p/38951

I have submitted a suggestion to appropriate engineering team  . Ask them to make it clear and add some examples for using env context to this document.  

2 Likes