Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2021
What would you like to do?
name: Share Data
on: [push]
runs-on: [ubuntu-latest]
# This will NOT work. These two `run` steps are written
# as different scripts and run by different shells, so
# the `FOO` variable will NOT persist between them.
# 这个方式行不通。这两个 `run` 会被写入
# 不同的脚本中,而且运行在不同的shell环境下,所以
# `FOO` 变量不会在它们之间持续存在。
- run: export FOO=bar
- run: echo $FOO
runs-on: [ubuntu-latest]
# This will set the FOO environment variable within the
# first `run` script, then instruct GitHub Actions to make
# it available within subsequent `run` steps as well.
# 这将在第一个 `run` 脚本中设置 FOO 环境变量值,
# 然后指示 Github Actions 使在接下来的 `run` step 中这个环境变量可用。
- run: |
echo "FOO=bar" >> $GITHUB_ENV
- run: |
echo ${{ env.FOO }}
echo $FOO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment