How can I take my release_notes.txt file in the root of my project and set it as an ENV variable?

I’m using the hockey app step and it has a section for “Notes attached to the deploy” so It would seem like I can put an environment variable in there. I would like to (in the step previous to this) export a file like release_notes.txt as an env variable so that it can be referenced there.

I assume that would be the best way to do this unless there’s another way.

I found a help article a few hours ago and it shows my exact use case… although I can’t help but think it’s out of date?

I’m not familiar with envman and it seems like I can use

or

This is what I tried and ultimately failed. I used basically what was in the docs here:

- script@1.1.5:
    inputs:
    - content: |-
        #!/bin/bash
        envman add --key MY_RELEASE_NOTE --valuefile ./README.md
    is_always_run: true
- script@1.1.5:
    inputs:
    - content: |-
        #!/bin/bash
        envman add --key MY_RELEASE_NOTE2 --valuefile /README.md
    is_always_run: true
- script@1.1.5:
    inputs:
    - content: |-
        #!/bin/bash
        envman add --key my_note --valuefile /README.md --expand false
    is_always_run: true
- script@1.1.5:
    inputs:
    - content: |-
        #!/bin/bash
        envman add --key my_note2 --valuefile README.md --expand false
    is_always_run: true

It can’t find the file at all. It’s in the root of my project. Any way to echo the contents of my dir?

Hi @coltonidle,

Why do you think it’s outdated?

envman add --key MY_RELEASE_NOTE --valuefile ./README.md

should work just fine, given that there’s a README.md file in the directory where you run it (by default in the repository’s root).

If that doesn’t work I’d suggest you to add this before running envman:

pwd
ls -alh

envman add --key MY_RELEASE_NOTE --valuefile ./README.md

the ls command will list the “current” directory’s content, while pwd prints the full absolute path. With these you can see where you are and what’s there.

If this wouldn’t help please copy paste the related build’s bitrise.io URL so that we can look into its logs & config! :wink:

@viktorbenei I thought it might be outdated because I wasn’t sure whether I should “use” envman and how do I do that? There seems to be an “env” step and there’s envman that I can run in a “script” step. Didn’t know what I should actually be using.

1 Like

Both the step and envman can be used.

envman can be used in scripts / in any other tool, so its primary purpose is to allow you to expose env vars in any way you like, from any complex script or other config.

The Step covers most of the basic functionality (it uses envman internally too :wink: ) but of course it does not provide the same flexibility as calculating something in a Script (e.g. to expose a timestamp in a custom format) and expose that as an env var. For that you can use envman.