I have an workflow to publish nuget package on a release event, but i'm not able to strip the 'v' char from tagname. All my tag names are v${version} so i need to strip that 'v' and get the version only.
I'm with this workflow:
name: Nuget package publish
on:
release:
types: [published]
jobs:
nuget:
name: Nuget - Publish package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Verify commit exists in origin/master
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/master
- name: Set VERSION variable from tag
run: |
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release
- name: Pack
run: dotnet pack UVtools.Core --configuration Release --no-build --output .
- name: Push nuget.org
run: dotnet nuget push UVtools.Core.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
Problem at:
Run echo "VERSION=v3.2.0" >> $GITHUB_ENV
echo "VERSION=v3.2.0" >> $GITHUB_ENV
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
shell: /usr/bin/bash -e {0}
On my attempt to strip the 'v' VERSION is set to empty
error: File does not exist (UVtools.Core..nupkg).
How could i strip the 'v' from variable?
PS: Under a bash script on my machine i tested:
VERSION=v1.5.0
echo $VERSION
echo "${VERSION:1}"
Which produces:
v1.5.0
1.5.0