An environment expression is often assigned directly like the example below
- name: set up env var
env:
TAG: v1.2.3
run: echo $TAG
But how can I get the value from shell script evaluation? For example in my terminal I can get the current Tag by git describe --exact-match --tags $(git log -n1 --pretty='%h')
but when I try to put this script into the env as follow
- name: set up env var
env:
TAG: $(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
run: echo $TAG
the echo printed out $(git describe --exact-match --tags $(git log -n1 --pretty='%h')) which means it is not evaluated but treated as a string.
How can I get the value of git describe --exact-match --tags $(git log -n1 --pretty='%h') and assign it to the environment variable TAG ?