How to pass the output of a bash command to Github Action parameter
Now that set-env
is deprecated you can use set-output
to accomplish the same thing in this answer
- name: Retrieve version
run: |
echo "::set-output name=TAG_NAME::$(cat projectFile | grep -Po '(?<=Version>).*(?=</Version>)')"
id: version
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.token }}
with:
tag_name: ${{ steps.version.outputs.TAG_NAME }}
References:
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#using-workflow-commands-to-access-toolkit-functions
How to save the output of a bash command to output parameter in github actions
Use environment files
steps:
- name: Set the value
id: step_one
run: |
echo "FOO=$(git status)" >> $GITHUB_ENV
- name: Use the value
id: step_two
run: |
echo "${{ env.FOO }}"