Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDocument an example of tagging with a version #39
Comments
@nathany, AFAIK there is no other solution to dynamically set the |
@nathany Is there a better way? - name: Get version
run: echo ::set-env name=version::$(cat VERSION) Then: - name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
release_name: v${{ env.version }}
draft: false
prerelease: false |
PS: In my case, the version is stored inside my package.json and since I use actions/setup-node@v1, I extract the version like this: run: echo ::set-env name=version::$(node -pe "require('./package.json').version") |
Hi @PeterHewat , I also encountered a problem and want to create the version name and release notes from a txt file. Did you find a solution for this yet? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It took a few attempts to find a solution to get a version # to tag the releases with. In my case I have a VERSION file containing the version number, such as
0.1.0
. This solution should be applicable even if the desired version is stored elsewhere so long as it can be accessed from a bash shell.The first step gets the version via a run command and sets the output. See the documentation for set-output.
Then the id can be used to access the output for the tag and release name:
Is there a better way? I had no success using
cat
outside of arun
step, but I didn't try every possibility.In #31 I noticed that @fleskesvor wrote a more elaborate solution, which is another reason to document what GitHub Actions provides out-of-the-box.