Hi folks. I am not sure if this is the right place...
# github-actions
e
Hi folks. I am not sure if this is the right place to ask. I am having a hard time using the value of an env variable in another step in my github action workflow
Copy code
jobs:
  staging_environment:
    runs-on: ubuntu:latest
- name: BuildandPush
        id: build-and-push

        uses: docker/build-push-action@v2
        env:
          REPOSITORY_URI: ${{ steps.login-ecr.outputs.registry }}
          IMAGE_TAG: ${{ github.head_ref || github.ref_name }}-${{ github.sha }} 
- name: update image
  run: |
     echo  $IMAGE_TAG
I will like to be able to reuse the value of from IMAGE_TAG from previous steps
m
Copy code
echo "{environment_variable_name}={value}" >> $GITHUB_ENV
I would have three steps: 1. first set the IMAGE_TAG env variable 2. Use the IMAGE_TAG env var as input to
docker/build-push-action
env section 3. Use the same IMAGE_TAG env var later on in the workflow
👍 1