Skip to content

Using output from a run command in a future step #26139

Answered by weide-zhou
nodesocket asked this question in Actions
Discussion options

You must be logged in to vote

Hi @nodesocket ,

You need to filter the output result of the dockebuild.sh file, eg: use ‘grep’.

For instance, two outputs in sh file:

echo tag1=v1
echo tag2=v2

Then in workflow yaml file:

- name: get output value
        id: getimage
        run: |
          echo "::set-output name=tag::$(sh dockerbuild.sh | grep tag2)"
      - name: check the value
        run: |
          echo ${${{ steps.getimage.outputs.tag }}} # this will show 'v2', is the expected tag.

Or directly use ‘set-env’ in dockebuild.sh file:

echo "::set-env name=GA_DOCKER_IMAGE::repo-here:tag2"

then you can invoke it in yaml file with ‘$GA_DOCKER_IMAGE’ and used as action parameters.

- name: get the value from env
     …

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

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