First of all let me explain what I'm trying to do. I do write a c# .net application which I want to build if a tag was pushed to the master branch. This build should create a release named like Release {Tag}
. The release should get all the artifacts which got build by the Windows Server. Right now I fail to get the tag only without the stuff in front of it.
I did find a question on how to set an environment variable here but this seems to work on linux only like this. I did try to find the information in the official documentation but I don't get it into a working state. Currently I'm using the following code trying to get the tag from the commit.
name: Live build
on: [push]
#push:
# tags:
# - '*'
jobs:
build:
name: Create build artifact
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: develop
- name: Get current tag
run: echo '::set-env name=tag::${(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")}'
- name: Show current tag
run: echo "${env.tag}"
Unfortunately this is the result, which does not look correct to me
I did try to replace this part echo '::set-env name=tag::${(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")}'
the call with the following test
echo '::set-env name=tag::(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")'
echo '::set-env name=tag::$(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")'
echo ::set-env name=tag::$(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")
echo ::set-env name=tag::(("${env:GITHUB_REF}" -split "/")[-1] -replace " ","")
Nothing did work just yet ... The default shell is set to powershell in this setup.
edit: Adding documentation from GitHub