<p>Solution explained in <a href="https://docs.github.com/en/github-ae@latest/actions/learn-github-actions/variables" rel="nofollow noreferrer">https://docs.github.com/en/github-ae@latest/actions/learn-github-actions/variables</a></p>
<p>We can use GITHUB_ENV for variables within the job, or GITHUB_OUTPUT for variables explicitly across steps and jobs. No need for separate action</p>
<p>Like so <code>echo &quot;EAP=$(echo *.eap)&quot; &gt;&gt; $GITHUB_ENV</code></p>

CC BY-SA 4.0
2023-10-17T14:02:21.123Z
2023-10-17T14:02:21.123Z
psisis
<p>We’re developing embedded software which needs to be compiled inside an SDK container. I’m setting up a CI/CD pipeline so that we can compile, ssh-copy and ssh install it on the remote device. To make things more “thread-safe” (so that concurrent actions don’t interfere) I want to export the name of the compiled package so that I can install and clean up specifically that file on the remote device. I’ve tried normal export and an action that saves it to the “global store”, without success.</p>
<p>This is what I tried (all inside one job):</p>
<pre><code># Container step
         EAP=$(echo *.eap)

# Next step
      - name: Save .eap name to env
        uses: UnlyEd/github-action-store-variable@v3
        with:
          variables: |
            EAP=${{ env.EAP }}

# SSH step
        test -f $EAP
</code></pre>

<docker><github><github-actions>
Github Actions: How to export a variable from within Docker and reuse across steps?
psisis
# Github Actions: How to export a variable from within Docker and reuse across steps?

(Asked by: username_0 on 2023-10-16)

We’re developing embedded software which needs to be compiled inside an SDK container. I’m setting up a CI/CD pipeline so that we can compile, ssh-copy and ssh install it on the remote device. To make things more “thread-safe” (so that concurrent actions don’t interfere) I want to export the name of the compiled package so that I can install and clean up specifically that file on the remote device. I’ve tried normal export and an action that saves it to the “global store”, without success.
This is what I tried (all inside one job):
# Container step
         EAP=$(echo *.eap)

# Next step
      - name: Save .eap name to env
        uses: UnlyEd/github-action-store-variable@v3
        with:
          variables: |
            EAP=${{ env.EAP }}

# SSH step
        test -f $EAP

**Tags:** docker, github, github-actions


---

## 1 answers

### Answer by username_0 on 2023-10-17. Score: 1

Solution explained in <https://docs.github.com/en/github-ae@latest/actions/learn-github-actions/variables>

We can use GITHUB\_ENV for variables within the job, or GITHUB\_OUTPUT for variables explicitly across steps and jobs. No need for separate action

Like so `echo "EAP=$(echo *.eap)" >> $GITHUB_ENV`


---

