I want to create a release tag from a workflow with GitHub Actions using actions/create-release@v1. I am specifying the same value for the tag name and the release name, which is v${MAJOR}.${MINOR}.${PATCH}, where MAJOR, MINOR, and PATCH are defined under env at the beginning of the yaml file before all jobs like this:
env:
MAJOR: $(cat VERSION.txt | cut -d . -f 1)
MINOR: $(cat VERSION.txt | cut -d . -f 2)
PATCH: $(cat VERSION.txt | cut -d . -f 3)
Here is the part where I invoke the create-release action:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # this token is created by Actions, no need to set it up ourselves
with:
tag_name: "v${MAJOR}.${MINOR}.${PATCH}" #THIS DOESN'T CAST MAJOR, MINOR, PATCH
release_name: "v${MAJOR}.${MINOR}.${PATCH}"
This creates a tag name that is explicitly v${MAJOR}.${MINOR}.${PATCH}. The environment variables are not converted to their values. When I use v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} instead, I get a not well-formed tag name.
When I echo v${MAJOR}.${MINOR}.${PATCH}, I get the desired output, which is something like v5.9.1.
How can I make the tag name use the values of the environment variables ?