To infer "version" on a Github Actions workflow run:
- name: "Set current version"
id: current-version
# When 'github.ref' starts with "refs/tags" it is a tag. Then we can infer the current
# version from it. For example, given 'github.ref=refs/tags/1.6.0', the current version is 1.6.0.
run: echo "version=${{ fromJSON('{"true":"${GITHUB_REF#refs/*/}"}')[startsWith(github.ref, 'refs/tags')] || 'next' }}" >> $GITHUB_OUTPUT
Set the trigger as:
push:
# Remember, if a push event contains tags, it ignores the "paths" filter.
tags: