How to use Github Release Version Number in Github Action
It should be ${{ github.event.release.tag_name }}
. The structure of a release can be found here: https://developer.github.com/v3/repos/releases/#get-a-single-release
I'd also suggest to use
on:
release:
types: [published]
instead of created to avoid putting something to npm for draft releases. See: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#release-event-release
Hint:
To debug the event you can use:
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Dump env
run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
You can get tag version using ${{ github.event.release.tag_name }}
.