Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variable usage for tag #3

Closed
cilerler opened this issue Oct 5, 2019 · 4 comments
Closed

Allow variable usage for tag #3

cilerler opened this issue Oct 5, 2019 · 4 comments

Comments

@cilerler
Copy link

cilerler commented Oct 5, 2019

I want to provide a tag number via environment variable set in earlier steps; however, it treats it as a string.

tag: $buildNumber

then I came up with the workaround below

tag: buildNumber

(I'm sorry, my shell scripting is not good enough, so I came up with something like this in here)

if [ ! -z "${TAG}" ]; then
  if TAGFROMENVVAR=$(printenv ${TAG}); then
    if [ ! -z "$TAGFROMENVVAR" ]; then
      TAG="${TAGFROMENVVAR}"
    fi
  fi
fi

it checks if the given name exists in an environment variable or not.

@meeDamian
Copy link
Owner

I agree that it's annoying vars aren't accepted by action inputs :(.

Using env vars indeed seems like the right approach.

@meeDamian
Copy link
Owner

meeDamian commented Oct 6, 2019

I've added support for passing tags through an env var here: 351fcec .

You can test it now by (for now) running sth like:

steps:
  

  - name: This step creates the tag name
    run: |
      TAG="v"
      TAG="${TAG}1"
      TAG="${TAG}.0"
      TAG="${TAG}.0"

      echo ::set-env name=RELEASE_TAG::"${TAG}"

  - uses: meeDamian/github-release@ad87d28
    with:
      token: ${{secrets.GITHUB_TOKEN}}
  

Please let me know if it works for you :).

@cilerler
Copy link
Author

cilerler commented Oct 6, 2019

It works for me since I can pass the environment I have.
Actually, the way you implemented is better since it restricts the variable name to use.

Thanks 🤗

@meeDamian
Copy link
Owner

Glad to hear that 😁!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants